My input is the string “Chase Field” for Facility - value, but I need the front end to send the id: integer from the reference table (3 in this case) to the back end instead of a string.
Here is my current Formula that gets me to where I can see the id: 3, but I can’t figure out how to get the value changed to 3.
From what I understand, do you want your items to have sequential ids? If so, leave your backend responsible for this, for example in supabase you can create an automatic sequence, whenever a line is created, it generates the id automatically
My back end does handle the key assignment. The problem is that my Facilities table is a different table that is related to the Schedule table that I am updating; the related column uses the integer key (Xano, BTW).
Chase Field’s ID on the facilities table is 3. If I select “Chase Field” on my front end and it sends the string “Chase Field” to the back end I get an error because the back end is expecting an integer to update the related field.
Just add .id at the end of your formula. You can also wrap the whole formula together with the .id with toNumber() formula - just in case. BTW it is not a good idea to filter database records by non unique fields. If you somehow have two records with the same name but different ids (which is obvously possible) then the first one will be used. I suggest to rethink the logic so that ID could be used to filer the data.
I’m a bit of a noob, so I tried adding “.id” to every possible area in the formula and all of them return nothing except for the one below. It seems to be getting me further from a solution by bringing in the other objects. The problem seems to be that I don’t know how to get into that nested list.
Stepping back to the bigger picture might help. On my front end I have a select field that populates the option list by using a Xano add-on to get the names from my facilitiesOnlyList.data table. This is working as expected. I don’t want to use the id here because 1, 2, 3… mean nothing to the user.
The workflow then adds a record to a different table (fullSchedule) that needs the integer id for the specific chosen facility.
I know that this isn’t best practice in general, but I am trying to slam out a fast proof-of-concept while trying to avoid the worse practice of just adding a “facility” column, hard coding text into my data, and using a rollup(). All of the WeWeb tutorials use the hard coded column method so they haven’t been useful for this.