Deserializing multiple conditional dropdowns

Hey @mcernat

There is small thing you may be missing

Could you please show the json string which you are trying to serialize…

Thanks
#nK

1 Like

Hi @Nithinkrishna!

Thank you for your swift reply!

This is for the Subcategory1

{
“label”: “Subcategory1”,
“tableView”: true,
“data”: {
“values”: [
{
“label”: “Five9”,
“value”: “five9”
}
]
},
“validate”: {
“onlyAvailableItems”: false
},
“key”: “subcategory1”,
“conditional”: {
“show”: true,
“when”: “category”,
“eq”: “subcategory1”
},
“type”: “select”,
“indexeddb”: {
“filter”: {}
},
“input”: true
}

And this one for the Subcategory2

{
“label”: “Subcategory2”,
“tableView”: true,
“data”: {
“values”: [
{
“label”: “AD”,
“value”: “ad”
}
]
},
“validate”: {
“onlyAvailableItems”: false
},
“key”: “subcategory2”,
“conditional”: {
“show”: true,
“when”: “category”,
“eq”: “subcategory2”
},
“type”: “select”,
“indexeddb”: {
“filter”: {}
},
“input”: true
}

Kindly let me know if anything else is needed, or if I provided the wrong details!
Thank you again!

1 Like

From this json you are trying to get values property ?

#nK

That is correct!
I am trying to get the values property based on the conditional dropdown that the user is selecting. In our scenario, subcategory2, that has the value “ad”.
The workflow won’t bypass the subcategory1 deserialization. This is where I am stuck, if he selects subcategory1 then the workflow will get stuck at subcategory2 deserialization.

I will seriously consider learning a programming language after this case. :slight_smile:

1 Like

Hey @mcernat

Kindly try the below, please.

(SubOutput("values")(0))("value")

Add .ToString if required

This should help, please let me know if you face any issues.

Thanks
#nK

The Deserialize JSON activity TypeArgument is: System.Collections.Generic.Dictionary<System.String, System.String>
Activity type:Deserialize JSON
Output > JsonObject > SubOutput

SubOutput variable type:System.Collections.Generic.Dictionary<System.String, System.String>

I tested it with .ToString or without it, the same result.

Check the screenshot for the new error message.
I am 100% that I am doing something wrong, or there is a misplaced configuration somewhere, and I can’t figure it out. :frowning:

Thank you!

1 Like

Don’t worry this will be resolved. Let’s work together :slight_smile:

Ok now it’s time to only print SubOutput("values")

Check this first please

Thanks
#nK

1 Like

Hi @Nithinkrishna

Unfortunately, the same error message as before.

Thank you!

1 Like

Could you please give me the userinput json variable string value in full which you are trying to deserialize. Just print it and send it to me please.

This is for the parent dropdown (called category)

{
“label”: “Category”,
“tableView”: true,
“data”: {
“values”: [
{
“label”: “Subcategory1”,
“value”: “subcategory1”
},
{
“label”: “Subcategory2”,
“value”: “subcategory2”
}
],
“json”: “”,
“url”: “”,
“resource”: “”,
“custom”: “”
},
“validate”: {
“onlyAvailableItems”: false,
“required”: false,
“custom”: “”,
“customPrivate”: false,
“strictDateValidation”: false,
“multiple”: false,
“unique”: false
},
“key”: “category”,
“type”: “select”,
“indexeddb”: {
“filter”: {}
},
“input”: true,
“placeholder”: “”,
“prefix”: “”,
“customClass”: “”,
“suffix”: “”,
“multiple”: false,
“defaultValue”: null,
“protected”: false,
“unique”: false,
“persistent”: true,
“hidden”: false,
“clearOnHide”: true,
“refreshOn”: “”,
“redrawOn”: “”,
“modalEdit”: false,
“dataGridLabel”: false,
“labelPosition”: “top”,
“description”: “”,
“errorLabel”: “”,
“tooltip”: “”,
“hideLabel”: false,
“tabindex”: “”,
“disabled”: false,
“autofocus”: false,
“dbIndex”: false,
“customDefaultValue”: “”,
“calculateValue”: “”,
“calculateServer”: false,
“widget”: null,
“attributes”: {},
“validateOn”: “change”,
“conditional”: {
“show”: null,
“when”: null,
“eq”: “”
},
“overlay”: {
“style”: “”,
“left”: “”,
“top”: “”,
“width”: “”,
“height”: “”
},
“allowCalculateOverride”: false,
“encrypted”: false,
“showCharCount”: false,
“showWordCount”: false,
“properties”: {},
“allowMultipleMasks”: false,
“idPath”: “id”,
“clearOnRefresh”: false,
“limit”: 100,
“dataSrc”: “values”,
“valueProperty”: “”,
“lazyLoad”: true,
“filter”: “”,
“searchEnabled”: true,
“searchField”: “”,
“minSearch”: 0,
“readOnlyValue”: false,
“authenticate”: false,
“ignoreCache”: false,
“template”: “{{ item.label }}”,
“selectFields”: “”,
“searchThreshold”: 0.3,
“uniqueOptions”: false,
“fuseOptions”: {
“include”: “score”,
“threshold”: 0.3
},
“customOptions”: {},
“useExactSearch”: false,
“id”: “e9i6q6”,
“keyModified”: true
}

This is for the conditional dropdown 1 (called subcategory1)

{
“label”: “Subcategory1”,
“tableView”: true,
“data”: {
“values”: [
{
“label”: “Five9”,
“value”: “five9”
}
],
“json”: “”,
“url”: “”,
“resource”: “”,
“custom”: “”
},
“validate”: {
“onlyAvailableItems”: false,
“required”: false,
“custom”: “”,
“customPrivate”: false,
“strictDateValidation”: false,
“multiple”: false,
“unique”: false
},
“key”: “subcategory1”,
“conditional”: {
“show”: true,
“when”: “category”,
“eq”: “subcategory1”
},
“type”: “select”,
“indexeddb”: {
“filter”: {}
},
“input”: true,
“placeholder”: “”,
“prefix”: “”,
“customClass”: “”,
“suffix”: “”,
“multiple”: false,
“defaultValue”: null,
“protected”: false,
“unique”: false,
“persistent”: true,
“hidden”: false,
“clearOnHide”: true,
“refreshOn”: “”,
“redrawOn”: “”,
“modalEdit”: false,
“dataGridLabel”: false,
“labelPosition”: “top”,
“description”: “”,
“errorLabel”: “”,
“tooltip”: “”,
“hideLabel”: false,
“tabindex”: “”,
“disabled”: false,
“autofocus”: false,
“dbIndex”: false,
“customDefaultValue”: “”,
“calculateValue”: “”,
“calculateServer”: false,
“widget”: null,
“attributes”: {},
“validateOn”: “change”,
“overlay”: {
“style”: “”,
“left”: “”,
“top”: “”,
“width”: “”,
“height”: “”
},
“allowCalculateOverride”: false,
“encrypted”: false,
“showCharCount”: false,
“showWordCount”: false,
“properties”: {},
“allowMultipleMasks”: false,
“idPath”: “id”,
“clearOnRefresh”: false,
“limit”: 100,
“dataSrc”: “values”,
“valueProperty”: “”,
“lazyLoad”: true,
“filter”: “”,
“searchEnabled”: true,
“searchField”: “”,
“minSearch”: 0,
“readOnlyValue”: false,
“authenticate”: false,
“ignoreCache”: false,
“template”: “{{ item.label }}”,
“selectFields”: “”,
“searchThreshold”: 0.3,
“uniqueOptions”: false,
“fuseOptions”: {
“include”: “score”,
“threshold”: 0.3
},
“customOptions”: {},
“useExactSearch”: false,
“id”: “eukrksmh”,
“keyModified”: true
}

This is for the conditional dropdown 2 (called subcategory2)

{
“label”: “Subcategory2”,
“tableView”: true,
“data”: {
“values”: [
{
“label”: “AD”,
“value”: “ad”
}
],
“json”: “”,
“url”: “”,
“resource”: “”,
“custom”: “”
},
“validate”: {
“onlyAvailableItems”: false,
“required”: false,
“custom”: “”,
“customPrivate”: false,
“strictDateValidation”: false,
“multiple”: false,
“unique”: false
},
“key”: “subcategory2”,
“conditional”: {
“show”: true,
“when”: “category”,
“eq”: “subcategory2”
},
“type”: “select”,
“indexeddb”: {
“filter”: {}
},
“input”: true,
“placeholder”: “”,
“prefix”: “”,
“customClass”: “”,
“suffix”: “”,
“multiple”: false,
“defaultValue”: null,
“protected”: false,
“unique”: false,
“persistent”: true,
“hidden”: false,
“clearOnHide”: true,
“refreshOn”: “”,
“redrawOn”: “”,
“modalEdit”: false,
“dataGridLabel”: false,
“labelPosition”: “top”,
“description”: “”,
“errorLabel”: “”,
“tooltip”: “”,
“hideLabel”: false,
“tabindex”: “”,
“disabled”: false,
“autofocus”: false,
“dbIndex”: false,
“customDefaultValue”: “”,
“calculateValue”: “”,
“calculateServer”: false,
“widget”: null,
“attributes”: {},
“validateOn”: “change”,
“overlay”: {
“style”: “”,
“left”: “”,
“top”: “”,
“width”: “”,
“height”: “”
},
“allowCalculateOverride”: false,
“encrypted”: false,
“showCharCount”: false,
“showWordCount”: false,
“properties”: {},
“allowMultipleMasks”: false,
“idPath”: “id”,
“clearOnRefresh”: false,
“limit”: 100,
“dataSrc”: “values”,
“valueProperty”: “”,
“lazyLoad”: true,
“filter”: “”,
“searchEnabled”: true,
“searchField”: “”,
“minSearch”: 0,
“readOnlyValue”: false,
“authenticate”: false,
“ignoreCache”: false,
“template”: “{{ item.label }}”,
“selectFields”: “”,
“searchThreshold”: 0.3,
“uniqueOptions”: false,
“fuseOptions”: {
“include”: “score”,
“threshold”: 0.3
},
“customOptions”: {},
“useExactSearch”: false,
“id”: “eouq0a”,
“keyModified”: true
}

Big thanks!

1 Like

I dont think you will get this json outside your form right ?

This is the component json present inside formd design?

If possible, please attach the zip file of the process.

Hello @Nithinkrishna ,

Correct, that was the JSON present inside the form designer.
This is what I managed to extract after changing the Deserialize JSON activity TypeArgument to Newtonsoft.Json.Linq.JObject, and the Write Line variable type to JObject ,and Text to SubOutput.ToString.
Processing: output.txt…
Screenshot 2021-11-14 171225

Is there a way of storing these responses for the tags (“name”,“company”,“category”,“subcategory2”) to use them later into Type Into activities? I must transfer them to a web browser.

Since I am a new member of this community, it won’t allow me to upload the entire process. Will the Main.XAML file suffice?

I am sorry for the headaches, as I know that I am not that technical at UiPath, and I hope that I will get better with time. :stuck_out_tongue:

2 Likes

Don’t worry. It’s all learnings :slight_smile:

Ready to help anytime and any number of times.

Now after deserialization just access subOutput("name").ToString and similar to that all your keys :slight_smile:

This should give you the output.

Try and let know.

Thanks
#nK

1 Like

Hello again @Nithinkrishna !

VariableName(“value”) will work for Forms Text Fields and Drop-Down Lists, but sadly, it won’t work for conditional Drop-Down Lists. If the Field Key > Property Name could be the same for every conditional Drop-Down List, then this wouldn’t be an issue anymore. Every conditional Drop-Down List has a different Property Name (“account”,“application”,“cloud”,“database” and so on).

This is where the issue occurs. If the user selects the Application category, a hidden conditional field is revealed to allow him to select a Subcategory for the Application category (Troubleshooting). At this phase, if the first Write Line activity in the workflow is ValueName(“account”), the workflow will stop with the previously provided error message:
Write Line: The given key was not present in the dictionary.

The Subcategory field key/property name (in blue circle) will change from case to case, based on what the user will select in the Category field, and I don’t know how to store it, since it is not the same field key with every case.

Thank you!

1 Like

Sorry @mcernat for delayed response.

Just try this please…

subOutput(subOutput("category").ToString).ToString

Thanks
#nK

1 Like

Hi again my friend @Nithinkrishna!

It is working!!! You are the best :robot:!!!

One last question and we can close this topic. How can I transfer the result form subOutput(subOutput(“category”).ToString).ToString to a new variable, since I already have the subOutput variable created.
I need to use the result from subOutput(subOutput(“category”).ToString).ToString in a Type Into activity.

When using subOutput(subOutput(“category”).ToString).ToString in a Type Into activiy, it won’t input anything in the browser UI, even when the Deserialization and User Browser activities are part of the same sequence.

Thank you very much!!!

1 Like

Actually it should work directly in TypeInto if all variables are in scope

If not you can just assign it to a new string variable using assign activity and pass it to TypeInto

Both ways should work :innocent:

Thank you
#nK

1 Like

Hi @Nithinkrishna !

Thank you very much for your help on this problem.
I have created a new variable where I have stored the value from the conditional dropdown CategoryOutput(CategoryOutput(“category”).ToString).ToString
The new variable looks like this
SubcategoryOutput(CategoryOutput(“category”).ToString).ToString

One quick note, I have no explanation for it, but to make it work, I had to clone the first Type Into activity. Only in this way, it will type the value into the UI element in the browser. It doesn’t matter if I will disable one of them, in which order, or if I delete them both to create a new one from scratch. It won’t work.
I tried adding a delay between activities, adding extra anchors and other combinations to no avail.

Thank you very much for your help as you’ve been very kind!

I hope that whenever you need some help, someone like you will do the same for you as you did for me.

Peace to you my friend, and for your loved ones.

1 Like

Thanks @mcernat It mean a lot

Hope you enjoyed it. Keep enjoying.

Anytime
#nK

1 Like

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