Each value then creates a row (including user_id & goals_id) on my database on Xano.
As the workflow on the screenshot shows (see below), the only solution I found is to generate an API request to create a row. Is there a way to create multiple request within ONE request? Thank you!!
Hi, If I understand well you can use our loop system !
You can make the loop iterate through your selection variable, and put your request block inside the loop so it will be executed for every item in the variable. You will be able to bind to the loop context
Hi, you should put everything in a object variable containing all your needed data and pass this to Xano. Then you can deal with the list of objects on backend. This way you will not call the same API several times.
However @Alexis method will work anyway but using loop is highly recommended anyway.
Never done that. I’m a bit of a rookie and afraid I don’t full grasp how to do that. Would you be able to show this on a visual manner? I think that’d help a lot
Hi, that’s because you bound the wrong thing (sorry maybe I did the same in my demo), you bound the items 0 of the list, instead of the current item (key “item” above)
When I bind to “Loop_obj.loop.index” on each line (goals_id,target_amount,goal_deadline) I always get the same “current value” (here 2 in this loop sequence). Is there a thing here to bind to the correct value ?
Hi, the explorer will show the same index every time you try to bind but the value of item and index will change for every iteration of course (except if there is a bug)
So here you should bind loop->item->amount to target_amount for example, and probably loop->item->date to goal deadline
Hi Alexis,
Me again It’s a follow-up to the question so I reactivate it - again-.
I have a problem when I send the Goals_id to Xano and could not find how to solve it.
I will try to explain as clear as I can:
On Xano, I have a “goal” table with goal names, goal_id (i.e. Goal_ID 1=Buy something; Goal_ID 2=Eliminate debt, etc.) and, each goal specificity (about 5 columns).
I have a second table named “user goal details”. This stores all goals a user has chosen along with many other information. This table has a relationship to the “goal table”. So in the “user goal details” table, the goal “Buy something” is just named “1”).
Now on WeWeb, the user can select a goal (through checkbox) with the text label (e.g. Buy something or Eliminate debt) but the “value” in Weweb is the Goal ID (1, 2, etc.)
Now if I put “Buy something” in the value, when I send the data to the “user goal details” table through the API on Xano, it’s rejected because Xano expects the Goal ID “1” in its language for “Buy something”.
Given I reuse the checkbox value in the process, the Goal ID “1” does not make sense to the user. So, I would like to send “Buy something” to Xano instead of the Goal ID (“1”).
Is there a way I can build a mapping table on Weweb or another trick? I hope it’s clear and sorry if it’s not .
Can you show me how do you manage the checkbox ? I dont understand where are you displaying the raw values (1, 2, …) to your users.
If you are using a select you can have a label different from the value and so the user will see the label but you will display the value. You can also create your own formula and use a switch to resolve every possible value (if you have like 5 different goals you can do it easily) to return the corresponding label for a given value, if you need to display it somewhere else
The value of the checkbox (i.e. goal ID) feeds an array of objects including 3 information: Goal ID, Amount, and Date. When the user selects the goal, it feeds one information in the array of objects:
On the next page, I have a datagrid where the user is asked to provide further details for each goal he/she selects. That’s when the rest goes into the array of objects. This is where I struggle because the user sees the raw values (1,2, etc). FYI (there will be about 10 goals in total with all very specific information)
As I said, you can create your own formula to it translate the number to the label, and use it inside your datagrid
With a switch you can enter every variant you have switch(myVariable, myValue1, myLabel1, myValue2, myLabel2, ...)
If it change change and/or you dont want to maintain this formula, you can try to do something more dynamic by loading your table containing all the goals and doing a formula that find the label in the list for a given goal id
Thanks ! I tried the “switch” formula and almost works.
The switch formula on itself works but, when landing on the datagrid page, it remains “11”, “12”, etc. Now, if I remove the formula, and copy-paste it again, it correctly displays the correct label (i.e. Buy something, Eliminate debt").