Validation date

0
Hey guys, So, I have a simple question but I can’t get to the right answer alone.. I have a Order, Customer and  Product database and the Customer can only make on order per week.. How can I validate that? Is it an expression, if that so, how it would be?   Thanks guys.
asked
2 answers
0

Hi Alan,

I will assume here that there is a date for each order and that the order is associated with one customer through a *-1 association (it would have been more helpful if you could describe your design in more details). You can then retrieve from the database the first order that is associated with the current customer (having orders sorted by OrderDateTime in descending order), and you can use daysBetween($LastOrder/OrderDateTime, [%CurrentDateTime%])>=7 if you care to have exactly 7 days between the date AND time if the last order and the current date AND time; otherwise, if you don’t care about the time of the last order you can just trim the time making the expression look like this: daysBetween(trimToDays($LastOrder/OrderDateTime), [%BeginOfCurrentDay%])>=7

Feel free to reply to this answer with any concerns or additional details that I did not take into consideration.

answered
0

How do you define “once per week” – does that mean once every 7 days or can the user place an order on Sunday and on Monday? There is a token [%BeginOfCurrentWeek%] ( or [%BeginOfCurrentWeekUTC%]), hope that helps. 

answered