Hello AppSheet Community
I am attempting to have a field in my form prepopulated, so I wrote this expression, but the field still will not be prepopulated. What did I do wrong?
Thanks.
Tiffany
ifs(index(split(agid test entry[well position],โ-โ),2)=โ4Cโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))+1) , โ1Aโ),
index(split(agid test entry[well position],โ-โ),2)=โ1Aโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ1Bโ),
index(split(agid test entry[well position],โ-โ),2)=โ1Bโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ1Cโ),
index(split(agid test entry[well position],โ-โ),2)=โ1Cโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ2Aโ),
index(split(agid test entry[well position],โ-โ),2)=โ2Aโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ2Bโ),
index(split(agid test entry[well position],โ-โ),2)=โ2Bโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ2Cโ),
index(split(agid test entry[well position],โ-โ),2)=โ2Cโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ3Aโ),
index(split(agid test entry[well position],โ-โ),2)=โ3Aโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ3Bโ),
index(split(agid test entry[well position],โ-โ),2)=โ3Bโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ3Cโ),
index(split(agid test entry[well position],โ-โ),2)=โ3Cโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ4Aโ),
index(split(agid test entry[well position],โ-โ),2)=โ4Aโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ4Bโ),
index(split(agid test entry[well position],โ-โ),2)=โ4Bโ,
concatenate((max(extractnumbers(index(split(agid test entry[well position],โ-โ),1)))) , โ4Cโ),
)
Solved! Go to Solution.
This reminds me of a question about generating sequential invoice numbers that came up the other day. You might want to check out that thread for inspiration: Incrementing Number when its a Key / Invoice Number Generation
Do you have just a fixed set of well numbers? If so, you might want to use a lookup table that has a column for well numbers and another column for the โsuccessorโ well number. You could then use LOOKUP() to initialize the value.
Otherwise, it might be easier to have your Well Position split into a column for each piece, so the row with 2-4C
would look like:
Iโd also add a reference to the most recently added row. That should also help with writing your formulas. See this app for an example: https://www.appsheet.com/samples/Initialize-forms-with-most-recent-value?appGuidString=18b39921-b8a8...
Then you could write separate initial values for the columns. For example, Number1 should be incremented if the most recent row had 4C:
IF(
AND([Most Recent Row].[Number2] = 4, [Most Recent Row].[Letter] = C),
[Most Recent Row].[Number1]+1,
[Most Recent Row].[Number1]
)
You could write similar formulas for the other parts, and then your Well Position initial value would be [Number1] & "-" & [Number2] & [Letter]
. You could hide the columns, so the end-user doesnโt see them.
Other community members might find a more concise way to do thisโฆ
BTW, I think the formula you had in your post was using agid test entry[well position]
incorrectly. That expression will return the entire list of values for the Well Position column.
Hi @tvinci. I think there are two routes we could go down (1) try to debug your expression (which is pretty complex), or (2) try to think of a different way to solve your problem that doesnโt involve such a complex formula.
I think itโs worthwhile to try (2) before (1). Could you say a little bit more about what youโre trying to do?
Hello Tony,
Thanks for your response. So, as you may or may not be able to guess from the expression, I have a list of โWell Positionโ values that look like this
1-1A
1-1B
1-1C
This reminds me of a question about generating sequential invoice numbers that came up the other day. You might want to check out that thread for inspiration: Incrementing Number when its a Key / Invoice Number Generation
Do you have just a fixed set of well numbers? If so, you might want to use a lookup table that has a column for well numbers and another column for the โsuccessorโ well number. You could then use LOOKUP() to initialize the value.
Otherwise, it might be easier to have your Well Position split into a column for each piece, so the row with 2-4C
would look like:
Iโd also add a reference to the most recently added row. That should also help with writing your formulas. See this app for an example: https://www.appsheet.com/samples/Initialize-forms-with-most-recent-value?appGuidString=18b39921-b8a8...
Then you could write separate initial values for the columns. For example, Number1 should be incremented if the most recent row had 4C:
IF(
AND([Most Recent Row].[Number2] = 4, [Most Recent Row].[Letter] = C),
[Most Recent Row].[Number1]+1,
[Most Recent Row].[Number1]
)
You could write similar formulas for the other parts, and then your Well Position initial value would be [Number1] & "-" & [Number2] & [Letter]
. You could hide the columns, so the end-user doesnโt see them.
Other community members might find a more concise way to do thisโฆ
BTW, I think the formula you had in your post was using agid test entry[well position]
incorrectly. That expression will return the entire list of values for the Well Position column.
I did this and it fixed it! Thank you
User | Count |
---|---|
17 | |
14 | |
8 | |
7 | |
4 |