You'll need to describe your current design in more detail.
I want to auto update a 'visit date' value list with the dates we are attending their site using a script trigger.
How exactly are you entering or selecting these dates? Are you creating records in a table of "visit dates" or something else?
Many thanks for responding to my question, it is very much appreciated.
I have attached the relationship diagram to give you a better idea of the data structure.
The layout is based on the 'Customers Bikes' table and the portal is based on the 'Bike Service Bookings' table. The visit date field in the portal is from the 'Service Visit' table.
My Plan was to have a button that opened a popup with a 'script trigger on open' that would set a variable to the 'site code' for the booking, then go to the 'Sites Visit' table perform a find for the sites code and then populate the Value list 'visit dates' with the Visit dates in the found set.
In the popup I was intending to have the visit date box with dropdown values from the 'visit dates' value list and an 'on modify' script trigger to then amend the 'bike service booking' record with the new information.
What I can't seem to be able to do is populate a value list from a found set - is there a script i am missing or is this not a simple as i had assumed?
I hope this is a little clearer now,
It's possible, but maybe a more complicated approach than you really need.
You have these relevant relationships:
If you modified that to add another Tutorial: What are Table Occurrences? of ServiceVisits like this:
with match fields like this:
ServiceVists::SiteCode = ServiceVisits|SameSite::SiteCode AND
ServiceVisits::cToday < ServiceVisits|SameSite::VisitDate
You could define a "use values from field" value list of dates from ServiceVisits|SameSite::VisitDate and specify the "include only related values starting from BikeServicebookings to get a value list of dates today or later for the same site. This produces the value list that you describe here without the need for the scripted find.
cToday would be an unstored calculation field defined with this expression: get ( CurrentDate ) and is used to omit dates from the past that might be found for a given site in your ServiceVisits table.
But if you still would like to use a scripted find to set up your conditional value list, you can find examples of that in:
It will take me a while to get my head around this but thank you very much,
I will try to get this working tonight/tomorrow.