Skip to main content
Participant
April 8, 2008
Question

dbase help

  • April 8, 2008
  • 3 replies
  • 493 views
hi, im trying to distinguish in a page we have to show calendar_status events on a page, and its defined by 0=unfilled, 1=filled. when i show the results on the cfm page edited, it only shows a 0 or 1. i would like it to show either unfilled or filled based on the number corresponding with database rule (0 or 1). how can i resolve this? thanks.
    This topic has been closed for replies.

    3 replies

    Inspiring
    April 8, 2008
    you are welcome, but if your db does support control flow (CASE, IF,
    etc) - you are better off using those, as Dan gave you an example for.

    i'd rather have a query return the exact data i need, than return some
    data which i then have to 'format' or 'decode' with cf code into what i
    need it to be...

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    Participating Frequently
    April 8, 2008
    For Access, you could use IIF, as in the following:

    SELECT IIf(calendar_status = 0, 'unfilled', 'filled') AS cal_stat
    FROM your_table
    WHERE whatever

    Phil
    xirniborAuthor
    Participant
    April 8, 2008
    Azadi thanks, the <cfif code works fine. thanks all for ur replies!
    Inspiring
    April 8, 2008
    if your db supports this type of syntax,

    select case when yourfield = 1 then 'filled' else 'unfilled' end somealias
    etc
    xirniborAuthor
    Participant
    April 8, 2008
    thanks for the reply. i actually may not have explained it very well. the dbase shows an event (CALENDAR_STATUS) with 0 or 1. the 0 = unfilled event, 1 = filled. on my frm_event_details.cfm page, im trying to add a section there for this. i have #getevent.CALENDAR_STATUS# , however it is just showing a 1 or 0. id like it to show what the 1/0 means (filled, unfilled) on the screen. thanks!!
    Participating Frequently
    April 8, 2008
    quote:

    like it to show what the 1/0 means (filled, unfilled) on the screen. thanks!!
    .... and that is what Dan suggested trying using CASE, assuming that dBase allows the use of CASE statements. Oracle has a function named decode() that allows you to "convert" one value to another so that if your database returns a 0 you can display 'unfilled', and if it returns a 1 you can display 'filled', etc.