SetValue on a field in a repeating table - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

SetValue on a field in a repeating table

Last post 10-07-2011 08:47 AM by Padraic. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 10-07-2011 07:44 AM

    SetValue on a field in a repeating table

    Hi,

    I am trying to to set the values of a couple of fields in a repeating table, I have tried the following and it does not work:

    concat("SetValue /my:Referral/my:LegislationDetails/my:LegislationRecord/my:legislationcat /value=", legislationcategory)

    Can you please advise?

    Thanks,

    Padraic 

  • 10-07-2011 08:09 AM In reply to

    Re: SetValue on a field in a repeating table

     Hi Padraic-

    SetValue sets the value of one field. We can use that command iteratively to set the value in multiple fields in a repeating table.

    Anyway, we'd love to help. Can you explain why it's not working? Can you display the Success, Error and Result nodes in the canvas and see that they show after the command executes?

    Thank you.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 10-07-2011 08:12 AM In reply to

    Re: SetValue on a field in a repeating table

    Hi Padraic,

    It appears you're missing the /xpath= before the XPath in your command.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-07-2011 08:13 AM In reply to

    Re: SetValue on a field in a repeating table

    First, please drag the Error node from the Qdabra Rules data source onto your form - it will help you debug these issues by providing error info.

    I think you are missing a parameter:

    concat("SetValue /xpath=/my:Referral/my:LegislationDetails/my:LegislationRecord/my:legislationcat /value=", legislationcategory)

    That command should set the first instance of legislationcat to your value. If you want to set a specific instance, you can add an XPath filter.

    concat("SetValue /xpath=/my:Referral/my:LegislationDetails/my:LegislationRecord[my:someotherfield='", someothervalue, "']/my:legislationcat /value=", legislationcategory)

    for example....

    Hilary Stoupa

  • 10-07-2011 08:38 AM In reply to

    Re: SetValue on a field in a repeating table

    Hi,

    Thank you all. I was missing the /xpath= statement and this command now works.

    However, I now have another issue and it is this:

    I have a preview section that displays a couple of cascading dropdown boxes. My desired outcome is that when the user selcts the values in those dropdown boxes, the values will be placed in a new row in the repeating table. There is an "Add to List" button in the preview section that uses the Insert command to add the row, which it does successfully, Within the same action, I use two SetValue commands to populate the repeating table. This works fine for the first row, but when I add any subsequent rows, all the rows get populated with latest selection from the dropdown boxes.

    The InsertRows rule that I have set up contains the following actions: 

    my:position + 1 

    concat("Insert /parent=/my:Referral/my:LegislationDetails /child=/my:LegislationRecord /posn=", position)

    concat("SetValue /xpath=/my:Referral/my:LegislationDetails/my:LegislationRecord/my:legislationcat /value=", legislationcategory)

    concat("SetValue /xpath=/my:Referral/my:LegislationDetails/my:LegislationRecord/my:legislationref /value=", legislationtype)

    Can you please advise?

    Thanks

    Padraic 

  • 10-07-2011 08:42 AM In reply to

    Re: SetValue on a field in a repeating table

    How about these:

    concat("SetValue /xpath=/my:Referral/my:LegislationDetails/my:LegislationRecord[last()]/my:legislationcat /value=", legislationcategory)

    concat("SetValue /xpath=/my:Referral/my:LegislationDetails/my:LegislationRecord[last()]/my:legislationref /value=", legislationtype)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-07-2011 08:47 AM In reply to

    Re: SetValue on a field in a repeating table

    Thanks Jimmy.

    Works perfectly now.

    Much appreciated.

    Padraic.

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.