Change path of a dropdown listebox

D

DolceVita

Hi,

I'm asking me if it's but possible with C# code (or without) to change
the path of a dropdown listebox depends on one fields in the primary
datasource!

for example the following repating section:

....
<Element id="21">
<Path>Root/Data/Model</Path>
<Texte>
<Choice></Choice>
<Text/>
</Texte>
</Element>
....

Choice is my dropdown, Path is where I can find the items to show in my
dropdown and id is the condition!

So in my dropdown the path to select is:

Root/Data/Model[@id='21']

the value and display name is the selected element of the path (Model
for this example)!

The problem is that in another occurence of my repeating section I have
my dropdown with other path and naturally other content!

Is it possible to do this? or not?

Thanks
 
A

Adam Harding

Hi

Yes it should be possible with very little coding

Set the DD-Box to filter according to what the Choice box is.

Then to make sure the filter is unique to this particular choice set the
filter to say where Choice on DD-Box Info is equal to Choice on the form.
Then change the filter by selecting 'The expression'.

Then replace the full path of the 'node' relating to the choice on the form
with

Current()/'Choice'

Then it will only pull back the info filtered on whatever the current Choice
is.

I hope this helps.

Any further questions i shoud be able to help as i have setup a fair few of
these before.

Cheers Adam
 
D

DolceVita

Hi

Thanks for your help for the condition I'm agree with you no problem
but for the Path here is the probleme.

take another example:
...
<Element id="21">
<Path>Root/Data/Model</Path>
<Texte>
<Choice></Choice>
<Text/>
</Texte>
</Element>
<Element id="24">
<Path>Root/Currents/User</Path>
<Texte>
<Choice></Choice>
<Text/>
</Texte>
</Element>
...

So do you think it's possible to change the path of the dropdown for
that this path correspond to the path contain in my XML (like you do
for the condition but for the path)?

Thanks
 
A

Adam Harding

Hi

Are you telling me in the first email that this works allright for the first
instance of your repeating table?

Cheers Adam
 
D

DolceVita

Hi,

I don't understand your last comment! but I think the answer is :no

what I can have (example):

for the first element of my dropdown listebox (DDL) the xpath is:
Root/Data/Model[@id='21']

For the second it's: Root/Currents/User[@id='21']

for the third that can be : Root/Sale/Item[@id='23']

That always change and this path can be found in in primary datasource
and it's for search in the secondary linked to my DDL

Is it possible the change the complete xpath expression in Infopath?

I hope that is clear now!

Thanks
 
A

Adam Harding

Hi

I think i understand now

You need an extra field in your Root/ to filter by to differentiate between
Root/Currents/User/@id and Root/Sale/Item/@id. then set a filter such that
if id=21 then use the field you added to tell it to then look for id field in
roots/currents/user/@id
Or id-23 at root level use the field you added to tell it to look for
Root/Sale/Item/@id

So in answer to your question YES

Add a field at root level that differentiates and use filtering to achieve
the desired result.

Cheers Adam
 
D

DolceVita

Hi,

I dont really understand what you try to say me and I don't believe
that I have you right explain!

Can you send me an e-mail so I have your right e-mail and I can send
you an example?

Thanks a lot for all!
 

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