Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7085 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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

Posted

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?

Posted

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

Posted

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

This topic is 7085 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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