Need help on set value qrules - InfoPath Dev
in

InfoPath Dev

Need help on set value qrules

Last post 05-16-2011 08:25 AM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-13-2011 06:38 AM

    • B1rds
    • Not Ranked
    • Joined on 03-24-2011
    • Posts 10

    Need help on set value qrules

    Hi first I must say what an excellent tool qrules is just downloaded it yeareday and it has solved major issues for me. But one remains :-)

    I have 2 repeating tables one where I ask the user to complete a repeating table to confirm if they have set controls in place, if they answer no using qrules insert comand a new action in another repeating table is created that must be completed, however my  isssue is that I wish to copy the control description that is not in palce to the action description in the action table. The Set up is as per below. Therefore I want to set the last row in the repeating table with the control that is not in place on teh current row in the hazard table. I hope this all makes sense I have looked at the qrules library but it only states that this is difficult to do.. Any help most welcome

    Tks Mike 

    Myfields

       Hazards

           HazardName (repeating table)

           Control_1 (Filtered to be tied to specific Hazards)

                Status_1 (In Place or Not In Place)

           Control_2

                Status_2

       Actions

           Action_Des (Only added to is a specific control is not in place)

           Action_owner

           Due_Date

  • 05-13-2011 08:53 AM In reply to

    Re: Need help on set value qrules

    Hi:

    Glad you like qRules -- we love it and use it internally for a lot of our forms (which is one of the reasons it keeps getting new commands-- we add to it as we need things!).

    I'm not quite sure I understand your issue -- but if what you want is to set the value of a specific field in your repeating table, SetValue is the command to use. You should be able to use last() to get the last one.

    SetValue /xpath=my:myFields/my:Actions[last()]/my:Action_Des /value=123

    Since you want to use a value from your form, you'd use a formula:

    concat("SetValue /xpath=my:myFields/myActions[last()]/my:Action_Des /value=", pathToFieldYouWant)

    Can you tell me where 

    B1rds:
    I have looked at the qrules library but it only states that this is difficult to do
    is in the documentation? I'm assuming you mean the user guide? I'd like to correct that, since I believe what you are trying to do is not actually that difficult with qRules

    You'll need to copy the XPath to your Action_Des field, as I'm just guessing on the syntax, but then you can add [last()] to get the last row. Where the value placeholders are above, you can use the InfoPath field selector in the formula editor to select the correct node from your HazardName group -- probably something like:

    current()/my:Control_1[@my:Status_1 = 'Not In Place']

    But again, just guesses. If you need additional help, you can attach your form to the Options tab of a reply and I can help you get the command syntax right -- but I may need more description of what you are trying to accomplish if I've misunderstood.

    Hilary Stoupa

  • 05-16-2011 04:01 AM In reply to

    • B1rds
    • Not Ranked
    • Joined on 03-24-2011
    • Posts 10

    Re: Need help on set value qrules

    Hi Hilary,

    Thanks for your help, I have successfully applied the first  Set Value comand and it inserts the 123. What I want to do is set the Action Des field when a control is not in place with that controls name. 

    However when I try and direct it to the current Control_1 value to copy this to the Action_Des I draw ablank, the following is the command that I am using

    concat("SetValue /xpath=my:myFields/my:Actions[last()]/my:Action_Des /value=", my:myFields/my:Hazards[current()]/my:Control_1)

     Again your help is very much appreciated

  • 05-16-2011 04:03 AM In reply to

    • B1rds
    • Not Ranked
    • Joined on 03-24-2011
    • Posts 10

    Hillary I have also attached the file to this post

  • 05-16-2011 05:17 AM In reply to

    • B1rds
    • Not Ranked
    • Joined on 03-24-2011
    • Posts 10

    Re: Need help on set value qrules

    Hi,

    Finally got it to work myself using teh following code

    concat("SetValue /xpath=my:myFields/my:Actions[last()]/my:Action_Des /value=", ..) where.. is the current field value, thanks again for pointing me in the right direction 

     Mike

     

  • 05-16-2011 08:25 AM In reply to

    Re: Need help on set value qrules

    Looks like you squared yourself away just fine while I was still asleep! Great job!

    Hilary Stoupa

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