Hi,
I'm trying to populate a field ${DEVICE_ID} with either the corresponding Inbox value or a calculated value for a new record?
The new ${DEVICE_ID} value is calculated from a barcode scan. pulldata("@javascript", "split_barcode_string.js", "getIDFromDeviceStringAndGivenIndex", ${DEVICE_SCAN},":",3)
I've tried and if statement but not sure how you can reference an Inbox variable, any ideas?
if(${survey_mode}='new',${DEVICE_ID_NEW},<Inbox Device ID Variable>)
Thanks for any suggestions.
Solved! Go to Solution.
A single form in S123 shouldn't be an issue. I have a very similar workflow, but I built the app in PowerApps. I do have something similarish in S123 though.
I wouldn't necessarily use the Inbox though. All you need is a bar-code scanner (obviously) and pulldata(). Here are the three workflows I'd see working in a single form (if you wanted to use the inbox):
I use something similar in S123 with project numbers. When a project number is located, pulldata() extracts all the required fields from the FL.
Honestly, not entirely sure what you mean. The workflow is missing a couple steps for me. But I will take a guess though...
Does that sound about right? In that case, where they are two different fields and only one should have data at one time, I would use a calculate (as you mentioned), but would use coalesce() rather than if(). Coalesce() is similar to an if() in this case, but takes far less effort. Coalesce() takes the first non-null value. E.g.,
coalesce(${field_1},${field_2})
The result will be either field_1 or field_2. It will take whichever value isn't null first, starting from the left.
There is no reason this shouldn't work with your survey or the inbox (same with the if() statement, honestly).
If you are still having trouble, uploading your XLSX would help.
Thanks for the response, after rereading my post I believe that I haven't made it very clear.
Each action above can be completed in their own survey123 form, but I don't see how the two actions can be combined into a single form.
As I understand it for the inbox to populate the field eg ${device_id} I can't have the pulldata call there. Using the coalesce(<Inbox Device ID Variable>,pulldata("@javascript", "split_barcode_string.js", "getIDFromDeviceStringAndGivenIndex", ${DEVICE_SCAN},":",3)) or an if statement I can't see how to distinguish between the new record calculation, or an inbox supplied variable.
A single form in S123 shouldn't be an issue. I have a very similar workflow, but I built the app in PowerApps. I do have something similarish in S123 though.
I wouldn't necessarily use the Inbox though. All you need is a bar-code scanner (obviously) and pulldata(). Here are the three workflows I'd see working in a single form (if you wanted to use the inbox):
I use something similar in S123 with project numbers. When a project number is located, pulldata() extracts all the required fields from the FL.
Thank Abureaux, for your responses.
Although I haven't implemented your solution I do believe it should work.
After discussion with the customer they want the ability to add new records and update records as separate apps. As almost all records are currently in the database.
Regards,
Elliott