Logic Builder condition for date field relative to current date
Started 8 years ago by timcov | 7 posts |
I very new to the MachForm but it is fantastic. I can't believe I've been wasting so much time messing with the hosted solutions such as the numerous online survey builders etc. Complete control over the data at last!
Anyhow quick question - I can set the default for a date field for "tomorrow" or "+2 days" (surprisingly simple) but that doesn't work in the logic builder which seems to need specific dates. Is there a notation to use to achieve skipping a page unless the value of a date field is tomorrow for example?
Thanks for a great product.
Unfortunately it won't be possible to set relative date as part of the rule. Sorry :(
Thank you for your feedback on this though. It's a very good idea.
Thank you for the prompt response
However needing to overcome this for a particular application and not wishing to give up - is it worth my while either:
a) looking for the php code that applies the rule and trying to "hard code" that rule instead? or
b) create a cronjob to run a linux job on my hosting each morning that takes today's date, adds 1 to it and then updates the rule in the MySQL table: ap_field_logic_conditions accordingly?
I appreciate both would be crude solutions but I'm reluctant to ask the administrator to login each morning and change the rule to tomorrows date.
Option b) is perhaps safest as I only follow enough about php coding to find relevant sections of existing code and make simple tweaks. At least with b) I'm only trying to update one field in one record of the database with a text format of the system date and am not trying to change the code itself?
If you are familiar with cron job, then yes option B would be the safest and cleanest, because it won't affect any other functionality. Simply update the "rule_keyword" column on "ap_field_logic_conditions" table.
Many Thanks Yuniar - it works. For anyone that needs it the sql query I used to reset the day in the condition to "the day after tomorrow" was:
$sql = "UPDATE
rule_keyword= DATE_ADD(CURRENT_DATE(),INTERVAL 2 DAY) WHERE
MySql Event Scheduler would be a better way to run it regularly but my shared hosting doesn't seem to allow me to enable it.
This is a great idea for something such as an "age of majority" checker, to have the person enter their date of birth and display additional information (such as parent/guardian information).
I'm looking at this thread and the code makes no sense to me (I'm a designer, not a developer).
What do I need to do to implement the fix shown here?
You must log in to post.