Populating another control from infopath

P

Paul Devenney

Hi All,

I would like to populate a text box based on the value in a dropdown (which
has been pulled from a SQL data source) - easy I hear you say? easy to put
the *value* in....but what about the description of that control

The actual scenario is

* select a paragraph from a dropdown list
* populate the text box with the text
* edit the text in the box from the starting point

I cannot make the value of the dropdown the text to push into the textbox,
as I need to record the ID that was oringally selected before the user goes
on to edit text.

I've tried various mad xpath queries, I can get the value from the dropdown,
I can get the data from the sql table (unfiltered), but trying to use the
where clause it all breaks down. I have the suspicion that it is to do with
using two different datasources in the one query (SQL source and Main)


please help!

Paul
 
P

Paul Devenney

To start to answer my own question

xdXDocument:GetDOM("My
Data")/dfs:myFields/dfs:dataFields/d:tblServices/d:tblHeadings/d:tblStatements/@Description[../@StatementGuid
= xdXDocument:get-DOM()/my:Report/my:Headings/my:Heading/my:field2]



as a rule in the dropdown box to populate the text box does the
trick....UNTIL you get to repeating groups.

I'm not sure how to change
xdXDocument:get-DOM()/my:Report/my:Headings/my:Heading/my:field2 into
something that works for repeating groups.

Any advice would be appreciated, I'm finding XPath all a bit mad.

Paul
 
D

dsc2bjn

You may want to try using the cascading list box example at:
http://office.microsoft.com/en-us/assistance/HA011177131033.aspx



Paul Devenney said:
To start to answer my own question

xdXDocument:GetDOM("My
Data")/dfs:myFields/dfs:dataFields/d:tblServices/d:tblHeadings/d:tblStatements/@Description[../@StatementGuid
= xdXDocument:get-DOM()/my:Report/my:Headings/my:Heading/my:field2]



as a rule in the dropdown box to populate the text box does the
trick....UNTIL you get to repeating groups.

I'm not sure how to change
xdXDocument:get-DOM()/my:Report/my:Headings/my:Heading/my:field2 into
something that works for repeating groups.

Any advice would be appreciated, I'm finding XPath all a bit mad.

Paul


Paul Devenney said:
Hi All,

I would like to populate a text box based on the value in a dropdown
(which has been pulled from a SQL data source) - easy I hear you say? easy
to put the *value* in....but what about the description of that control

The actual scenario is

* select a paragraph from a dropdown list
* populate the text box with the text
* edit the text in the box from the starting point

I cannot make the value of the dropdown the text to push into the textbox,
as I need to record the ID that was oringally selected before the user
goes on to edit text.

I've tried various mad xpath queries, I can get the value from the
dropdown, I can get the data from the sql table (unfiltered), but trying
to use the where clause it all breaks down. I have the suspicion that it
is to do with using two different datasources in the one query (SQL source
and Main)


please help!

Paul
 
P

Paul Devenney

Ok I've managed to solve the problem:

The best way to do this is have an extra field at the root of your main
datasource - a "dummy" if you like

set 2 rules on your dropdown

1) pass the ID/Guid into the dummy
2) Set the textbox equal to the value of the dummy

This will work even if the dropdown/text box pair are inside a repeating
group, providing you fully qualify the path to dummy eg

xdXDocument:get-DOM()/my:Report/my:dummy


cheers,

Paul


dsc2bjn said:
You may want to try using the cascading list box example at:
http://office.microsoft.com/en-us/assistance/HA011177131033.aspx



Paul Devenney said:
To start to answer my own question

xdXDocument:GetDOM("My
Data")/dfs:myFields/dfs:dataFields/d:tblServices/d:tblHeadings/d:tblStatements/@Description[../@StatementGuid
= xdXDocument:get-DOM()/my:Report/my:Headings/my:Heading/my:field2]



as a rule in the dropdown box to populate the text box does the
trick....UNTIL you get to repeating groups.

I'm not sure how to change
xdXDocument:get-DOM()/my:Report/my:Headings/my:Heading/my:field2 into
something that works for repeating groups.

Any advice would be appreciated, I'm finding XPath all a bit mad.

Paul


Paul Devenney said:
Hi All,

I would like to populate a text box based on the value in a dropdown
(which has been pulled from a SQL data source) - easy I hear you say?
easy
to put the *value* in....but what about the description of that control

The actual scenario is

* select a paragraph from a dropdown list
* populate the text box with the text
* edit the text in the box from the starting point

I cannot make the value of the dropdown the text to push into the
textbox,
as I need to record the ID that was oringally selected before the user
goes on to edit text.

I've tried various mad xpath queries, I can get the value from the
dropdown, I can get the data from the sql table (unfiltered), but
trying
to use the where clause it all breaks down. I have the suspicion that
it
is to do with using two different datasources in the one query (SQL
source
and Main)


please help!

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top