Set a condition in a repeating section

  • 18 March 2015
  • 4 replies
  • 5 views

Badge +11

I have a drop down list of items. The last item in the drop down list is the word 'Other'. I then have a text box that is to be populated if 'Other' is selected from the drop down list. I then want to merge both of these fields into another field. ie if Other is chosen then the value in the text box gets placed into the new field otherwise the drop down value gets placed into the new field.

The problem is that the 'Set A Condition' control only sees the main form fields and not the repeating section fields. So I'm not sure how to go about this merge for the repeating section data.

Field data Example: (attached)

Normally I would use the following, but the repeating section field names don’t appear in the ‘Where’ drop down in the control (see below). Is it possible to set this type of condition using repeating section data?

Screenshots (attached) :

1. Workflow 'Set a contidiont' control.

2. 'Where' drop down list in control config.

 
Any ideas?

Thanks


4 replies

Userlevel 5
Badge +9

I see that you are trying to update the field in your workflow. You could do that directly in the form by using a calculated value in your repeating section to display the "merge" of your two other fields.

But you can do it in your workflow. Actually everything that is in your repeating section is stored as XML. You can connect your repeating section to a multi line column to get the XML corresponding to the data populated in the repeating section. You can also get those data from an hidden field called FormData present in the list.

One you have the XML in a worfflow variable, you can then use the "Query XML" action to get the data foreach line of the repeating section. Here's the configuration of this action :

  • XML Source : XML
  • XML : your workflow variable where XML of your repeating section is
  • Process using : XPATH
  • Formula : //Item
  • Return results as : Outer XML
  • Store result in : a collection variable

Then you can use a foreach action (to loop through each item Inside the collection variable populated above) to extract the fields of each line of the repeating section. In the foreach, you can use the "Query XML" action with this configuration :

  • XML Source : XML
  • XML : your workflow variable used to store the result of the foreach
  • Process using : XPATH
  • Formula : //TheNameOfTheControlInsideYourRepeatingSection
  • Return results as : Text
  • Store result in : a text variable

Then if you want to update the data Inside the repeating section you can use the "Update XML" action.

Hope this helps

Badge +11

Hi

This is for a mobile form. Is it still possible to update the field directly in the form by using a calculated value in the repeating section to display the "merge" of your two other fields? I would love some instruction on that.

And I’ll have a go at the other.

Kind Regards,

Joanne Morris

Technology Systems Analyst

Fleet Technology

Userlevel 5
Badge +9

In the settings of the calculated value you can choose to recalculate the formula on view, new and/or edit mode. The calculated value can be used perfectly in a repeating section. Here's an example :

http://www.youtube.com/watch?v=myLjsHACbs4

I haven't tested the calculated value in a mobile form.

Hope this helps

Badge +11

Thanks for that. It may be useful in the future.

All of our forms are mobile via the App. I’ll be interested to see if this works for the mobile form.

Also this is nothing like my problem. So is of no use in this particular instance.

Kind Regards,

Joanne Morris

Technology Systems Analyst

Fleet Technology

Thiess Pty Ltd

179 Grey Street | South Bank QLD 4101

Locked Bag 2009, South Brisbane QLD 4101

T +61 7 3002 9428

M 0409 782 060

E jmorris@thiess.com.au<mailto:jmorris@thiess.com.au>

www.thiess.com.au<http://www.thiess.com.au/>

Reply