PDA

View Full Version : how to use xbasic on column values


ABC123

Steve Wood
09-27-2004, 12:12 PM
I have a column of dates. Occassionally they are blank yielding "//" in my grid display. How do I use xbasic in conjunction with display format to accomplish the following pseudocode example:

if(isblank("value"),"",time("W:MM-dd-yy","value")).

If I just use a display format of time("W:MM-dd-yy"), every blank date value produces an erroneous displayed value like this: ""BA:00-00-00".

Edward Larrabee
09-29-2004, 07:01 AM
The place to your code is in the validate event for the field.

Edward Larrabee
09-29-2004, 07:25 AM
An addition. The validate event is not yet available for grids, but is available for dialog forms.

Peter.Wayne
09-30-2004, 01:35 AM
You can display a calculated field in your grid. Just use your pseuocode to create a calculated field and display the calculated field.
You define calculated fields in the Query portion of the component definition.
e.g. if your field is named "billdate", then you can create a calculated field, "fmt_date", defined as
fmt_date=
if(isblank("bill_date"),"",time("W:MM-dd-yy","bill_date"))