In case someone finds it useful in future, I am posting my solution to a date validation problem.
I have a form with user inputs including a comma separated text string that contains a list of dates that will be parsed later into a SPLIT( <data> , ", ") function to iteratively generate one row for each element in the list using action loops. However, the action loop breaks when the user gives incorrect date formats (11/052025) or (11/05/2025, 12/05/2025 13/05/2025). To solve this, I first looked into the Valid If field and realised that appsheet expressions cannot check all elements in a list in one expression.
My workaround to minimize the error downstream is:
(COUNT(SPLIT([_THISROW].[Date(s)],"/"))-1) / COUNT(SPLIT([_THISROW].[Date(s)],", ")) = 2
This minimizes the "damage" to only have one row if the one of the dates gets typoed to (11/50/2025).
I have been somewhat unsuccessful in checking the elements are true dates.
Solved! Go to Solution.
Sure. Here is the approach.
1. Please add a table called say "Dates_Entry" with just three columns.
A. [ID] which is key column with UNIQUEID() as key. Turn off show_if for this column.
B. {Ref_To_Parent] which references the current table where you wish to enter the list of dates. Please make this {Ref_To_Parent] column with "IsPartOf" setting enabled. Turn off show_if for this column.
C. [Date] column
Please make reference column's "IsPartof" setting on.
In the form of "Dates_Entry" table make the settings "Auto Save" and "Auto Reopen" on
Well that is it. The user can now conveniently add the dates using the calendar widget that will appear during date column entry. You will get a list of dates as child table records for your main table record where you wish to capture the list of dates.
You can then either
A) use this dates list with suitable expression from the child table "Dates_Entry" itself. In this case you will need to retain the child table records.
B) You can export the list to the main parent table using say reference action on form save.
Please test thoroughly for your requirements.
Your exact requirement is not clear. However you may want to consider using an enumlist column with base type as date to create a dates list?. In that case the user will need to add dates one by one but any invalid date will be flagged off by the column itself without needing any additional validation. The user will be prompted for an invalid date.
Screenshot: Show valid date entry
Invalid date entry
Thanks for the suggestion!
My user would prefer to enter either a comma separated string of dates or select multiple dates from a calendar popup (to my knowledge, currently appsheet only allows that for one single date). The reason is that sometimes the user has to enter 15-20 dates in the field.
Using the proposed enumlist with date type will require too much clicking to add dates. So unless Appsheet supports clicking multiple dates from a calendar popup, I think my user will still prefer to submit a string.
@Sylwong wrote:
think my user will still prefer to submit a string.
Could you update how your user constructs the string?
Its not elegant. The user types it out in a word doc while looking at a calendar and then assembles the long string to enter into the appsheet form. I am trying to reduce the user's workload of having to look at the calendar and then physically typing the date, hence the idea of picking multiple dates from one calendar popup.
Thank you. Will this do as shown in the video?
The video for unknown reason does not capture the dates widget that appears during the entry of each date value but as the video shows, the user adds multiple dates and those show up in the form as a related list.
The list so captured can be processed further as per the app requirement that we can discuss. For example, moving it to parent record through an event action on form save etc. Once the list is moved to the parent record, the related table records can be deleted , say once a day or weekly depending on amount of records added or it may be retained for future edits etc. This will depend on app requirements.
Note: This post is suited for "Q&A" section at least for now. So I will request community admin to move it there.
Yes. That would be useful. Can you share with me about how you constructed it?
Sure. Here is the approach.
1. Please add a table called say "Dates_Entry" with just three columns.
A. [ID] which is key column with UNIQUEID() as key. Turn off show_if for this column.
B. {Ref_To_Parent] which references the current table where you wish to enter the list of dates. Please make this {Ref_To_Parent] column with "IsPartOf" setting enabled. Turn off show_if for this column.
C. [Date] column
Please make reference column's "IsPartof" setting on.
In the form of "Dates_Entry" table make the settings "Auto Save" and "Auto Reopen" on
Well that is it. The user can now conveniently add the dates using the calendar widget that will appear during date column entry. You will get a list of dates as child table records for your main table record where you wish to capture the list of dates.
You can then either
A) use this dates list with suitable expression from the child table "Dates_Entry" itself. In this case you will need to retain the child table records.
B) You can export the list to the main parent table using say reference action on form save.
Please test thoroughly for your requirements.
Thank you. That works.
You are welcome. Nice to know the suggestion works. if you could mention if the dates are handful and in sequence as your initial example shows, we could make it still more user friendly data entry operation.
Thanks for trying to improve the solution. The dates entered are somewhat sporadic. They are not always consecutive or periodic. The solution provided helps keeps everything in date format so i dont have to handle the mess of DD/MM/YYYY inputs and having to handling them as MM/DD/YYYY backend via code. That was not nice to play with. To be honest, I think the related dates entry method is a good alternative solution to not having the multiple date picker in one calender popup in appsheet.
@Sylwong wrote:
They are not always consecutive or periodic.
Okay, got it. Then, yes, I too believe the existing solution of dates in a related table is a better option. All the best.
After trialing this feature, looks like selecting the date from the calendar popup alone is not sufficient to trigger the auto-save. Still requires an extra click to click on the whitespace outside the field before it triggers auto-save.
Yes, that is correct. I believe the form's system software is such that it needs one confirmation that the data entry in the field is complete. Just being in any field may mean that the user is still under edit mode for that field. For example in your case, the user may want to change the date while being still in the field. However I agree that for fields such as dates, time and enums etc. where the user anyway selects from the presented options, this extra click could be done away with. But it can still be confusing to user. As soon as the user selects the date, the form may move to next field or save operation, giving the user no chance to review the date entry.
The extra click is indeed necessary for open ended data entry fields such as text, long text etc.
Edit: As mentioned a few times earlier, if we could recognize a pattern in dates data entry list, we could possibly further optimize it for user. However you too have confirmed that the dates are not in sequence. So I believe there is no possibly of any further optimization.
Also if you could mention more about the dates entry requirement, still more options could be explored. For example if the dates are going to be just in one year or one month, that too future dates from the date of data entry, then you could possibly explore valid_if based enumlist of dates from say a lookup table. Would be happy to discuss this approach also.
@Sylwong wrote:
However, the action loop breaks when the user gives incorrect date formats (11/052025) or (11/05/2025, 12/05/2025 13/05/2025).
This list seems to three consecutive dates. If the dates are going to be in the consecutive range and handful of dates, then we can find still an easier option . Request you to revert and we can explore the possibilities.
The current solution that uses the child table for dates entry caters to any dates irrespective of year.
User | Count |
---|---|
18 | |
10 | |
8 | |
5 | |
5 |