Copy link to clipboard
Copied
I have a small problem and I cant seem to find the solution too.
On my site, we have people filling out a very basic classified that appears in the weekly paper.
Our paper is produced every thursday, we also want the ads to appear on the site but they
must not display past the number of times they were selected to be inserted.
If someone fills the form out on Monday, March 30 (determined by #now()# and selects they want it to fun 3 times
I need to insert into my my classRunDate table the classified ID and the dates
EX
ClassifiedId RunDate
546 01/04/2010
546 08/04/2010
546 15/04/2010
Thanks in advance
Craig Wiseman
Copy link to clipboard
Copied
This goes to database design. I'd consider having a min date and max date field in the appropriate table. Then, when someone submits an ad, you can determine what n Thursdays from now will be and make that your max date. Then you can display the ad if the current date is less than that max date.
Copy link to clipboard
Copied
I agree you may want to re-think the structure. But to address the question about dates, you can use DayOfWeek() to identify the current "day" (ie 1-Sunday, ...., 7-Saturday) and some basic math to determine the number of days until the next Thursday (ie Day 5). Then use DateAdd("d", days, date) to calculate the new date(s). Check the date functions section of the documentation for more information.
Copy link to clipboard
Copied
A more straightforward design may be to have a table structure like this:
When you insert a new ad, you are (for example) given the starting date and the number of weeks. Based on this, you calculate the ending date.
Selection of the advertisements to be shown would select ads whose starting-date is on-or-before the current date, and the ending date is on-or-after the current date.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more