1 dropdown selection that populates other fields

I feel like I’m in the verge of getting this but not there yet.
OK it seems as more of the other questions are based on combining multiple dropdowns but in my case its a little different. As in Excel, Vlookup gives you a result based on another result. What is my Vlookup method in this case?

tubing data

On the picture I have a list of items. In appgyver I have setup a dropdown field where I can get the Names, say Tubing 2. I also have mutiple other fileds that need to populate the data associated to Tubing 2.

Hey,

I would continue like this:

Add a Selected value changed event and a Set page variable flow function to the dropdown’s logic canvas. The page variable should be a list of objects with the properties label and value and it will be the Option list for the next dropdown. In the Set page variable you can assign the correct options according to what is selected in the first dropdown.

1 Like

I may be understanding wrong or you may have mis understood me.
If I create just 1 dropdown for the names.
Than I create text field for example
Grade
Collapse
Burst
Strength

In the Names dropdown I pick “Tubing 2”

I want text fields with
Grade to automatically show “J-55”
Collapse as “10560”
Burst as “10360”
Strength as “18300”.

How can I get “Grade” text field to get answer from “Names” dropdown and use it to bring back “J-55” in that same row of the example picture? The text fields do not need to be modified.

Ah I see! Sorry for misunderstanding. But the same logic would apply by just binding the page variable to a text field instead of a dropdown as I first explained.

Another maybe simpler way would be to bind the dropdown selection to a page variable like selected_name and with a formula display the correct info in a text component. For Grade it would be something like FIND_BY_KEY(data.all_data, "Names", pageVar.selected_name).Grade . In any case you will need a data variable containing all the data you provided a screenshot of.

1 Like

Thank you so much. Although I got it working and it’s exciting just to understand how it works. I cannot get it to work on my preferred method.

You see, I have the same data in 2 different veríables.
1 thru REST api and is the one I got working which is super exciting,

the 2nd thru an app veriable pasted on the formula editor in the Global canvas. I prefer this because I can store the info locally. The drop down does work fine here but not the text field formula Find_By_Key. Would you happen to know what may be the problem?

Hmm so the app variable is identical to the data variable? So you should be able to replace the data variable in the formula with the app var, is the formula FIND_BY_KEY(appVar.all_data, "Names", pageVar.selected_name).Grade not working?

That is correct. Not sure if it’s the size of data in it. Right off the bat when I hover over and click “Name” in the formula, it shows the list of labels with the default 2 words in quotes. Data. All gives me the examples showing me it has picked up the values. That is why I wasn’t getting it the first time around.

Cecilia, Also when I change pages and come back. I keep the drop down selection but my field componants with formulas go blank. Im still working on saving the dropdown to local storage but what I am having trouble is understanding how to keep my values of my field to stay since my text components are based of the dropdown and although the dropdown is still populated, my text fields go blank. Are the formulas suppose to be dynamic? Or do I need some type of refresh when the page is on focus or mounted.

Hey,

I’m not sure I’m understanding the issue with “it shows the list of labels with the default 2 words in quotes”, can you provide some screenshots to clarify what is going wrong?

As for the other problem, you will probably have to change your formula for the text components. The example I gave with pageVar.selected_name might be the problem as the pageVar gets wiped after you leave the page → the formula doesn’t work anymore. So instead of a page variable you would have to use an app variable.

I changed to formula from page veriable to App veriable and it fixed it, although with a delay on the data coming in.

As far as the first issue I couldn’t remember “lorem ipsum” is what it was showing and not the sample values related to the table. This is how I recognized that its not finding the app veriable. Nevertheless, appvar. All_data will not work.

Ah yes the preview data that is shown in the app editor does not reflect on if the data fetches actually work, that can only be confirmed in preview.

So just to clarify, you are able to get the dropdown value to get stored between page changes, but the formula for the texts, such as FIND_BY_KEY(appVar.all_data, "Names", pageVar.selected_name).Grade is not working? But it did work when you were using the data variable in your formula? Then I would make sure that the app variable actually gets populated with the correct data, to debug you can e.g. add a text component to your page and use the ENCODE_JSON() formula to bind the app variable to the text to see its contents. Maybe modifying the formula a little could help, if LOOKUP(FIND_BY_KEY(appVar.all_data, "Names", appVar.selected_name), "Grade") would work better.

Yes. Changing from pagevars to appvars did the trick.

Secondly, I’ve found it is easier to use data.All_data and works a little different but since my app will be more of a calculator and due to internet connection I’m trying to stay away from Rest api. Using app.vars shows different viewer info than data.all_data but it seems to work fine now. This may have been after I structured the schema in the appveriable although something has changed. Data pasted in the right format is green and data with issues shows in red. At first it was green after pasting but now I guess it doesn’t match my schema somehow although it still works.

The solution was viewer does not respond the same even though it is working fine in the back ground And my formulas were not showing since my numbers were wrapped in quotes on the Json data (example: “123” instead of 123) which I fixed @ CSVJSON.Com does structure this data in the correct format.

I will check the 2 suggestions you gave me and get back with you.