June 17, 200520 yr 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.
June 17, 200520 yr 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
June 20, 200520 yr 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?
June 21, 200520 yr 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
June 23, 200520 yr 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