Alpha Video Training
Results 1 to 10 of 10

Thread: Field to display "blank" If....

  1. #1
    Member
    Real Name
    George Czar
    Join Date
    Oct 2005
    Location
    Georgia (USA)
    Posts
    136

    Default Field to display "blank" If....

    Hello

    I have been playing with several things and cannot for the life of me get this to work. I have a field which calculates based on a "time" calculation. If the beginning time and end time are not entered the field displays "-.05", this is because it should deduct 30 minutes based on the entries.

    Anyway -
    I'm wanting to add a display "blank" if it is equal to "-.05"
    I know you can change in the format tab to display blank if nothing.

    I tried to enter the calculation
    ((TOSECONDS(Inv_Test->Outime)-TOSECONDS(Inv_Test->Intime))/3600)-.5
    and add a If statement ----If (val(NoTimeEntry>-.05,"") I had set a variable called NoTimeEntry on the field - but I don't think I'm on the right track.

    Any clues?
    G

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default

    You left out many details in your question,

    I have a field which calculates based on a "time" calculation
    is this calculated field in a table or wherever you want to "display" the time value such as a report.

    I'm wanting to add a display "blank"
    display on a form, report, what?

    An if() construction has the structure if(logical condition, true result, false result). Your indicated attempt has only the first result.

    If your current calculated field yields "-:05" then you need a calculated field for the display something like

    if(left(calculated time field,1)="-","",calculated time field)

  3. #3
    Member
    Real Name
    George Czar
    Join Date
    Oct 2005
    Location
    Georgia (USA)
    Posts
    136

    Default

    Quote Originally Posted by Stan Mathews
    You left out many details in your question,
    is this calculated field in a table or wherever you want to "display" the time value such as a report. display on a form, report, what?
    An if() construction has the structure if(logical condition, true result, false result). Your indicated attempt has only the first result.
    If your current calculated field yields "-:05" then you need a calculated field for the display something like
    if(left(calculated time field,1)="-","",calculated time field)
    I'm sorry to leave anything out Stan.
    The field is within a form and a report.
    It displays -.50 on both if the user doesn't enter the intime/outtime.
    I wanted to get rid of the clutter on the form/report and just show "blank"

    See attached pic.

    George
    Last edited by czar_g; 06-02-2006 at 04:25 PM.

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default

    It appears that waittime is a table field, calculated, some expression - though you say it is "within the form and report". Your attachment seems to be a screenshot of an area of a browse.

    A possible calculated field for your form/report for display instead of waittime would be

    if waittime < 0,"",alltrim(str(waittime)))

  5. #5
    Member
    Real Name
    George Czar
    Join Date
    Oct 2005
    Location
    Georgia (USA)
    Posts
    136

    Default

    Your right Stan it is a screen shot of a browse.
    I tried to go into the calculation and add what you suggested but it keeps telling me it's invalid. I have the same calculation defined in one of my reports.

    IE
    WaitTime=((TOSECONDS(Inv->Outime)-TOSECONDS(Inv->Intime))/3600)-.5
    WaitTime= if WaitTime < 0,"",alltrim(str(WaitTime))

    Thanx
    George

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default

    "I tried to go into the calculation and add what you suggested" - I didn't give you anything to add to your present expression. My suggestion was a new calculated field for the form and or the report that you would place instead of waittime, for display purposes. The expression

    if waittime < 0,"",alltrim(str(waittime)))

    would display "" - empty string if waittime is less than zero

    or the value in waittime if is it is greater than zero. That is based on the screen shot you posted where it appears that waittime is numeric.

    You also said at one time - I'm wanting to add a display "blank" if it is equal to "-.05"

    There is a difference between -.05 and "-.05". If the waittime field is character then if(left(waittime,1)="-","",waittime) would be the expression for the new calculated field.

  7. #7
    Member
    Real Name
    George Czar
    Join Date
    Oct 2005
    Location
    Georgia (USA)
    Posts
    136

    Default

    Quote Originally Posted by Stan Mathews
    "I tried to go into the calculation and add what you suggested" - I didn't give you anything to add to your present expression. My suggestion was a new calculated field for the form and or the report that you would place instead of waittime, for display purposes. The expression if waittime < 0,"",alltrim(str(waittime))) would display "" - empty string if waittime is less than zero or the value in waittime if is it is greater than zero. That is based on the screen shot you posted where it appears that waittime is numeric.
    You also said at one time - I'm wanting to add a display "blank" if it is equal to "-.05" There is a difference between -.05 and "-.05". If the waittime field is character then if(left(waittime,1)="-","",waittime) would be the expression for the new calculated field.
    OK - I believe I'm following you - BUT
    When I try and create a new calculated field it tells me invalid expression.
    I'd tried to go in and edit it by placing

    if calc->Waittime<0,"",alltrim(str(calc->Waittime)))

    Same thing - it's drivin me nutso :confused:

    G

  8. #8
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Example is attached

    Since you don't seem to want to attach a sample of your tables I've constructed an example with a report that displays the calculated wait time if it is greater than zero and leaves the calculated wait time blank if it is less than zero.

    Hopefully this will demonstrate how it can be done and you can apply it to your files.
    Last edited by Stan Mathews; 03-28-2006 at 03:24 PM.

  9. #9
    Member
    Real Name
    George Czar
    Join Date
    Oct 2005
    Location
    Georgia (USA)
    Posts
    136

    Default

    Quote Originally Posted by Stan Mathews
    Since you don't seem to want to attach a sample of your tables I've constructed an example with a report that displays the calculated wait time if it is greater than zero and leaves the calculated wait time blank if it is less than zero. Hopefully this will demonstrate how it can be done and you can apply it to your files.
    UPDATE: HOPE THE LIGHT FROM THE BULB DIDN'T BURN YOU - LOL
    I just added the IF code to the calculation xy and called it a new field (NWAIT)
    Then it allowed me to eliminate the waitime column and performed the calcs and displayed blank like it was supposed to.. I didn't know it would do this.. duh.


    I'm so sorry Stan - I didn't know you may want a copy of my tables. It contains 10K+ records... I appreciate your sample provided and I see how it is to be done. It will work with the reports but the form has the Waittime field displayed.
    I was hoping with the addition it would display blank. It would seem I need both fields in order for the "blank" field to be true. If I delete the column "waittime" it no longer works.

    I suppose they will see the -.50 in the field.. lol

    Thank you
    George
    Last edited by czar_g; 10-17-2005 at 01:10 PM.

  10. #10
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default With form display and browse display

    If you create and save a named browse it can take the place of your embedded browse. Saved browses, forms, and reports can have calculated fields.

    Example attached.
    Last edited by Stan Mathews; 03-28-2006 at 03:24 PM.

Similar Threads

  1. "Enter new record"...not blank
    By Paul Simison in forum Alpha Five Version 5
    Replies: 24
    Last Post: 03-03-2005, 10:37 AM
  2. "Display only unique keys" not working
    By Jay Talbott in forum Alpha Five Version 6
    Replies: 7
    Last Post: 12-09-2004, 05:51 PM
  3. Cannot display "|" in web page
    By Willard in forum Web Application Server v6
    Replies: 4
    Last Post: 12-08-2004, 02:24 PM
  4. Line item data with "split display"
    By Mike Lange in forum Alpha Five Version 4
    Replies: 1
    Last Post: 05-13-2002, 07:38 AM
  5. FORCE NUMERIC NOT EQUAL "BLANK"
    By ken tjia in forum Alpha Five Version 4
    Replies: 6
    Last Post: 04-07-2002, 05:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •