Multi Combo Boxes - How to attribute values to Selected Tokens and If checked, add these values to App Variables?

Dears,
I’m building an app that serves as a diagnostic tool and collects pre-consultation data at oriental medicine school outpatient clinics (educational purpose).
Initially I was using a long form (like this web version made by me and javascript (dIAgno 1.0 WEB - Alfa) with a set of checkboxes describing symptoms and when the user presses a button the app :
1- Checks which checkboxes/symptoms are checked (Selected Tokens)
2- Assigns values, i.e. adds points (e.g. + 1 or depending on the symptom 2, 3) to app variables that are linked to categories of diseases that initially had zero values
3- Maps which 3 diseases received the most points.
4- Returns a report linked to the component that plots a graph informing these 3 diseases
I think the Multi Combo Box option would be more interesting from a visual and practical point of view, but for lack of experience I am struggling to program steps 1 and 2 above:
1- How can I check which options/symptoms were selected in several Multi Combo Boxes of this form?
2- After detecting the selected options/symptoms, how to add values/points in the variables that represent the diseases ?
I believe that items 3, 4 will be fine, but I am stuck on these steps 1 and 2.
If someone wants to help and allow me I would also be very happy to put their names in the app credits (educational)

Translated with DeepL Translate: The world's most accurate translator (free version)

Hi @assuntosgerais2021, you should be able to do it like this:

  1. Create page variables that you will use to store the information of which tokens are selected in which multi combo box.

  1. On the logic canvas of the Multi combo box component, use the “Receive event” node to listen to when the output value of Multi combo box changes. Whenever it does, set the page variable to the component output:

However, the binding of the tokens to a page variable does not seem to working as expected right now. I’ll make an internal bug ticket about this.

  1. Then on the page’s logic canvas, you can similarly listen to changes to the page variable to set your variable that is related to the diseases based on that. There you’ll need to use a formula function that evaluates which disease the symptoms are related to.

1 Like

Dear Mari,
Thank you very much for the Thanks for the quick and instructive reply. I will follow your instructions . Best regards !
Ephraim

1 Like

Dear Mari,
How are you ?
I came back to the production of the app. I was able produce until step 3 … I’m still trying to figure out a formula to check what tokens are selected and assign values/point to the diseases. Could you/someone help me with one example and I will try to adapt to the app ? My mindset is very IF…THEN oriented (basic) and I believe this is not the case here…I will be very glad ifI receive some hlep (an opportunity to learn )
1- Multibox 1 - 3 symptoms
2- If selected token = symptom 1 then add 1 point to the app variables disease A and disease B
3- If selected token = symptom 2 then add 1 point to the app variables disease A and disease F
4- If selected token = symptom 3 then add 1 point to the app variables disease B , disease C and 3 points to disease A…
I dont know if my explanation is clear.
I also would add a “severity warning” variable. If too many symptoms are selected, this variable will reach a pre-setted value and trigger some extra events (things like pop up a message strongly advising a medical consultation asap or even a button to the user call an emergency/ambulance number). But I believe that if I’m able to overcome this step 3 , I can use the same logical framework to adapt this “severity warning” function.
Thank you very much.
P.S: When the app is ready I will include your name (and anyone that helps) in credits. slight_smile: Thxs

Should the use of “If and Else” inside a formula be a clue to solve my issue ? I’m going to try it. If there is any documentation where I can read to solve my issue I will be very glad. I read the forum but until now could not find .Thanks

Hi, if you have a somewhat limited list of symptoms, you could have number type page variables for each of the diseases, with 0 set as their initial value.

Then:

  1. Whenever the selectedTokens list changes, set the disease counter page variables to 0
  2. Use “If condition” to check if a symptom is in the list. `IS_IN_ARRAY(pageVars.selectedTokens, {token: “Disease name”})
  3. If yes, set the disease counter variables to pageVars.disease1 + 1
  4. Keep going for rest of the symptoms