How to Pass a Variable in the Label of UiPath Forms?

Is there a way to use Variable/Argument in the Label?

for Eg I want my label to be>>>Please enter quantity for {product}:

product is a variable i want to pass a variable so its dynamic. I am running a for each row loop.
I am able to acheive this with Input Dialog Activity, not sure how to do it within the form designer?

any ideas on this?

You can try this within form designer after you first set the variable in FormFieldsCollection.

Screenshot 2021-04-13 220117

cc: @Tamilselvan

1 Like

@sangL sorry I think i wasnt very clear in my initial post.

is there a way to pass a Variable to the “Label” of the Text Field? I want to ask the user to enter a Quantity for every product in the column. Using For Each I want to populate the form with product name in the Label(above text field).

Hi @Haroon_Patel - Okay, perhaps you can try this and let me know if this will work for you… please let me know. (Top picture - you’ll have to add this key:value pair to the component JSON; Bottom picture - you’ll have to update the label field).

cc: @Tamilselvan

@sangL in the Component JSON line #6 is covered. Could you please clarify that for me. Getting error on line 3

I am using Uipath.Form.Activities 1.1.11 I have option for Trigger (selected JSON Logic) and Action as well.

Hi @Haroon_Patel - what you actually want to do is go to the edit JSON widget in the form designer – the buttons show up when you hover over the right side of the text field. Once you open that up, the code lines #1 - 6 should already be there. You just need to add line #7 from my previous screen shot → “redrawOn”: “data”. You should not have to add anything to the logic tab. Hope this helps clarify.

@sangL this is what I have. I should enter it on line 11?

in above “Enter the Quantity for Product:” <—“Product” I want it to be a variable so it can be dynamic. when I am running a for each loop with product names.

@sangL
When I enter “redrawOn”: “data” on line 7 or 11 it gives error: Expected ’ , ’ instead of ’ " ’

Forum0416.zip (3.0 KB)
@Haroon_Patel pls check my template.

@Haroon_Patel Form Dynamic Labels for Textfield.zip (43.1 KB)

Please find the sample workflow for dynamic labels in textfield.
Regarding your above query, you dont necessarily add “redrawOn” at line #7. you can add it at the end of the json. in your example, you can add it after line #10.
Please try the attached workflow and let us know. Thanks

3 Likes

@Tamilselvan
Thanks for your reply. Is Hidden Data added required ?
I want to know the reason. thanks.

Hi @lojyehuang I added hidden to hold the value of label.

1 Like

@Tamilselvan Thanks for your help!

Thanks everyone @lojyehuang @Tamilselvan @sangL for your help. I was able to make it work. With the attached workflow I was able to better understand how it worked.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.