Jump to content
  • 0

Multi select dropdown leading to conditional result


Bacon

Question

I have a datapage hat allows the user to (multi) select from a list of options and once they have selected some, it provides a result. The result is dependant on what is selected.
My table is set up using a list-string of items 'HAZARDS' and each of these is either a CAT B or CAT C item.

So the user selects from the HAZARD list and if they select any that are CAT C in the table, the result is CAT C, if they only select those which are CAT B it is CAT B.

I have used the following code:
CASE WHEN '[@ICAO_CAT]' LIKE '%CAT B%' OR '[@ICAO_CAT]' LIKE '%CAT C%' THEN 'C' ELSE 'B' END 

But it is not working - it allows a multi selection, but nothing happens with the ICAO_CAT result - it remains as B regardless. I have attached the table setup to show and a screenshot of the Datapage.

How do I get it to actually change based on the ICAO_CAT shown in the table?
 

 

Screenshot 2023-11-05 at 10.42.02.png

Screenshot 2023-11-05 at 10.59.56.png

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello @Bacon,

Could you clarify the expected value for the 'ICAO_CAT' field when the user selects multiple values from the 'hazard' field?
For example:
O2qN4b2.png

For me, the table on the screenshot looks like a lookup table that stores a list of possible 'hazard' values. https://howto.caspio.com/tables-and-views/lookup-tables/

The List-string data type is used to store the multiple values in the field (so, an array of values) and has a list of restrictions https://howto.caspio.com/tables-and-views/data-types/list/

If your table is a lookup table, use Text(255) data type for the 'hazard' field instead.
QDrOl39.png

When it is a Text(255) field, it can be a Dropdown and the 'ICAO_CAT' field can be a Cascading element (for example, Cascading Text):

https://howto.caspio.com/datapages/datapage-components/cascading-elements/


obcMj6c.png


pz1ethZ.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...