Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

display items depending on date

Featured Replies

Hi all,

I have spent a lot fo time reading posts and they have been very help full, but I have been unable to find an answer for my latest problem.. So if anyone can help I would be very greatfull.

I have a database of books online, giving details of each book etc, and a buy now link to an external shop site. Some of the books in the database are not as yet in print, so I don't want a user to be able to click on the link to buy them. I have been trying achieve this by using an If/ else statement with the current date and the date field I have in the database (the date field is when the book comes into print ie in the future), but I have been unable to get it to work. Can anyone tell me if it is possible using if/else or if there is any other way of doing it.

Thanks in advance

Ian.

Script can be as:

If(Today>Printing_Date)

PerformScript[by]

Endif

Are you using CDML?

If so, comparing dates with the [FMP-If] tags may be a bit tricky. However, you could use a Calculated field to determine the status of the publication. You can then select/sort etc on this field.

Good Luck.

Garry

  • Author

Yes I am trying to use CDML, but I haven't tried using a calculation field, as I've been trying to work it without adding fields to the database as i didn't put it together in the first place. What would I need to put in the calculation?

Your Calculation (pub_status) could look like this:

If(Today > print_date,"Published","Not Yet Published")

You can then use this in the CDML, e.g.:

FMPro?-db=mydb.fp5&-format=mypage.html&pub_status=Published&-find

or

[FMP-If: pub_status .eq. Published]

....

[/FMP-If]

This is one method, it may not suit you if the calculation slows down the searches too much.

All the best.

Garry

  • Author

Thanks for your help Garry,

That worked great.

Regards

Ian

Yeah, Garry's the best.

I wonder if Status(CurrentDate) might be a wiser choice, though, since the good folks on FMFORUMS once pointed out to me that Today usually only works when the database is opened on that same day and it won't work tomorrow (does not recalculate Today everyday whereas Status(CurrentDate) is always correct). If you find your solution drifting, try switching the calc and see if it gets better.

--ST

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.