Expression box for getting drop-down display name - InfoPath Dev
in

InfoPath Dev

Expression box for getting drop-down display name

Last post 02-21-2006 11:51 AM by rleist. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-21-2006 10:36 AM

    • rleist
    • Not Ranked
    • Joined on 01-12-2006
    • Posts 7

    Expression box for getting drop-down display name

    I have a form with where main view has a number of drop-down controls that are populated from a SQL database. The values for those fields are just index numbers to tables with the drop-down display names being more descriptive. I then created a separated view for printing so that the printed form just had text boxes instead of printing the drop-down controls. But, on the print view I wanted to display the more descriptive drop-down display name values instead of the index value of the forms field. I was able to do this by using an expression box that pulled the display name value from the secondary data source filtered so that the secondary data index field is equaled to the value of the form's field. Below is an example of the XPath from one of the expression boxes:

    xdXDocument:GetDOM("tblManufacturers")/dfs:myFields/dfs:dataFields/d:tblManufacturers/
    @MfgName[../@MfgID = xdXDocument:get-DOM()/my:ServerForm/my:Manufacturer]


    This worked great until I had a drop-down in a repeating section of table. At that point the XPath was just getting value of the field in the first section or row and all the repeating fields on the print view have the same value.

    Here is the original XPath i tried in a repeating table:

    xdXDocument:GetDOM("tblkEMCType")/dfs:myFields/dfs:dataFields/d:tblkEMCType/
    @EMCName[../@EMCID = xdXDocument:get-DOM()/my:ServerForm/my:VolumeTable/my:Volume/my:EMCVol_]


    Is there a way I can change this so it gets the index value from the appropriate section or row?

    Thanks,
    Rob
  • 02-21-2006 10:52 AM In reply to

    • rleist
    • Not Ranked
    • Joined on 01-12-2006
    • Posts 7

    Re: Expression box for getting drop-down display name

    One idea I contemplated was to create onChange events for the drop-downs that would set an attribute on the current field equal to the drop-down display names. Then on the print view I could display the attribute instead of the field value.

    Anyone have another idea?

    Rob
  • 02-21-2006 11:08 AM In reply to

    Re: Expression box for getting drop-down display name

    I think your expression boxes are also in Repeating section/table then, then your XPath should be
    xdXDocument:GetDOM("tblkEMCType")/dfs:myFields/dfs:dataFields/d:tblkEMCType/
    @EMCName[../@EMCID = current()/my:EMCVol_]

    In the above xpath I am assuming "my:Volume" to be the repeating node.


    Agni
    INFOPATHdev India
  • 02-21-2006 11:51 AM In reply to

    • rleist
    • Not Ranked
    • Joined on 01-12-2006
    • Posts 7

    Re: Expression box for getting drop-down display name

    Agni,

    Your assumptions are correct and your solution work.

    Thank you,
    Rob
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.