cascading lookup fields

By: Steven Clifton | Asked: 03/03/2023
ForumsCategory: How-tocascading lookup fields
Steven Clifton asked 2 years ago
i need to start a cascading lookup by the results of a previous field. select county to get the territory then equal that territory for the first selection of a second cascading lookup form 
3 Answers
Victor Font answered 2 years ago
Then you need to see this Knowledge Base article: https://formidableforms.com/knowledgebase/formidable-locations/
Steven Clifton answered 2 years ago
I have made progress but what I am now trying to get past is I need to have calculation that use the dynamic results of cascading forms. For example: Select construction type, then select county, the result is a rate multiplier. I need to then use that rate in a formula multiplying it with a dropdown list selecting coverage. this gives the base premium.
Michael ClarkMichael Clark replied 2 years ago

Let me take a crack at it, see if I'm understanding:

First, get the rate multiplier: [construction_type] + [county] = [rate_multiplier]

Next, select the [coverage]

Then build formula that calculates the [base_premium]: [rate_multiplier] x [coverage] = [base_premium]

If that's it, then you could test it out by putting the formula [rate_multiplier]*[coverage] in a text field calculation to see if it gives you the correct base premium and test it out by changing any of the variables.

Not sure I grasped it, but if so, I hope this helps!

Michael ClarkMichael Clark replied 2 years ago

NOTE: In the above scenario, the rate multiplier field is watching both the construction type and the county fields

Steven Clifton replied 2 years ago

You have it correct. where i have the problem is the rate_multiplier is the dynamic results of cascading lookup fields.

Michael ClarkMichael Clark replied 2 years ago

So does the rate multiplier field show the correct value when you change the construction type and/or county?

If so, place the shortcode for the rate multiplier field in the default value of a text field and see if it changes there too.

Steven Clifton replied 2 years ago

Yes, the rate multiplier is correct.
I have tried every way I could think if to get the rate multiplier to display in a text field. It will not.

Steven Clifton replied 2 years ago

Just to verify I am doing the shortcode in the text field correctly I changed it to the County field, and it displays and changes as I change the county.
I think the problem is that the rate field content is dynamic.

Steven Clifton replied 2 years ago

this seems to work: [frm-field-value field_id=558 entry=553] 558 is from current form 553 is from form CSV was imported into. this as default value (calculation). Plus I had to go to lookup and apply the same settings as the dynamic field.
Do you see anything wrong with this?

Steven Clifton replied 2 years ago

now my issue is I want to us an "=" sign in a conditional calculation. not just "" or "=>"
I want to know if [571] (text field location of [558]) is equal to 1 (a specific number)

Michael ClarkMichael Clark replied 2 years ago

Sorry I was away for a minute.

I'm still back on the original lookups... 🤓

Q: Is rate multiplier a value that changes based on construction type or county?

Q. Does the rate multiplier field watch the construction type field and the county field?

Q. Are construction type, county, and rate multiplier all in the same origin form?

Steven Clifton replied 2 years ago

yes to all three

Michael ClarkMichael Clark replied 2 years ago

Yeah. So the challenge is the difference between a lookup and a dynamic field. Maybe use [field_id show='..'], but use single quotes. Sounds dumb, and maybe it is, but I've had luck switching it up from using double quotes to specify the attribute. I'm sure there's a rul about somewhere I'm not aware of 😛

Victor Font answered 2 years ago

Dynamic fields store the entry id of the lookup record in the form entry. This means you can display the value of any field in the lookup record. Make sure you use the correct shortcode: [x show="y"] where x is the field id of form entry and y is the field id in the lookup record that has the content you want to display. https://formidableforms.com/knowledgebase/dynamic/#kb-display-dynamic-field-values

Steven Clifton replied 2 years ago

[559 show="554"] I have changed to this. However, when I preview the form i get this error:
[559 show="554"]
unexpected identifier 'show'

but does it works.

What do I have wrong?

Victor Font replied 2 years ago

Are you absolutely certain 559 is the field id for a dynamic field and not a standard lookup field? And, are you certain that 554 is a field in the lookup table record with the same entry id as the value stored in 559?

If you're certain, then I suggest you open a support ticket with Strategy 11.

Steven Clifton replied 2 years ago

Yes, I just verified that. and like I said it does work just has the error popup.

but [frm-field-value field_id=559 entry=554] also works but without any errors

Steven Clifton replied 2 years ago

[frm-field-value field_id=559 entry=554]
[frm-field-value field_id=559 show=554]

both of these work. which is the better one for me to use?

Victor Font replied 2 years ago

The first says retrieve the value from the dyamic row that has the entry id of 554. This means it's going to grab the first value it finds from entry id 554 regardless of the field you want to display. The second says retrieve the value of the field with the id of 554 from the dynamic lookup entry. Field ids and entry ids are completely different. Which works for what you want to do? Only you can decide that.

Steven Clifton replied 2 years ago

554 is the field (Rate) from my form that stores the cascading data.
559 is the field (Rate) in my public form that displays the dynamic content.
the only difference between the two options I have is "show=554" and "entry=554".
The user selects Contruction type and then selects County and the Rate is dynamic content that I need to use to multiply by the coverage.
What I want to make sure is that it is displaying the Rate from the current user's form.

Victor Font replied 2 years ago

Entry id and field ID are not the same thing. You say 554 is the rate field in your lookup table and 559 is the field in your connected form that receives the lookup value. The correct syntax for a view is 559 show='554' if you are using a dynamic field. If you look at the field in PHPMyAdmin, what is the value stored there? For a dynamic field, the value is the entry id of the lookup table row, not anything else. If there's anything other than the lookup table row entry id, it's not a dynamic field, which could be why 'show' isn't working.

Steven Clifton replied 2 years ago

before when I had
[559 show='554']
I got this error
unexpected identifier 'show'

However earlier today I had cleared my cache

Now I do not get the error and everything works properly

Thank you so much for your help!!

Steven Clifton replied 2 years ago

the other issue I had was it appears I cannot use "=" in a conditional formula. but this works
([574] > 0 || [574] < 2) ? ([562]) : (0)
for ([574] = 1) ? ([562]) : (0)

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right