Alpha Video Training
Results 1 to 5 of 5

Thread: Calculated field in a browse table

  1. #1
    Member
    Real Name
    Judith Donoghue
    Join Date
    Jun 2006
    Location
    Formby, UK
    Posts
    196

    Default Calculated field in a browse table

    Hi
    I have a browse table which list rows of bookings that have been made on the current day, it has one calculated field which gives the total of the bookings.

    The calculated field is: total = total(Number_Of_Dels)

    In this calculated field I need to exclude records that have the words 'Transferred' or 'Inhouse' in another field called Resp_type from the total. I have tried with if statements and marking records. I can get the correct 'total' by marking the records but then the marked records don't appear in the browse table.

    I would appreciate any help, pointers on how to achieve the total without losing the marked records in the browse table.

    Thanks in advance
    Judith

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

    Default Re: Calculated field in a browse table

    Total() doesn't accept a filter. To get the result you want I suggest you look at changing to tablesum().

    Something like tablesum("your_table_name","Resp_type != 'Transferred' .and. Resp_type != 'Inhouse'","Number_Of_Dels")
    or tablesum("your_table_name",".not. (Resp_type = 'Transferred' .or. Resp_type = 'Inhouse')","Number_Of_Dels")
    There can be only one.

  3. #3
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,595

    Default Re: Calculated field in a browse table

    Stan you come up with the most interesting stuff - eg. I did not know that .not. could be used with field types other than logical. I am thinking of adding a new subscription category for 'Stan Fixes' ...
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

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

    Default Re: Calculated field in a browse table

    Well, actually the field type doesn't matter. My expression just reversed the logical result of the character expression (Resp_type = 'Transferred' .or. Resp_type = 'Inhouse')".

    You can

    ? .not. (1=2)
    = .T.

    and you can

    ? invert(1=2)
    = .T.

    And using .and. or .or. can be fun.

    ? 2 .and. 1
    = 0
    ? 2 .or. 1
    = 3

    And to muddy the waters further.

    Code:
    ? convert_type(1,"L")
    = .T.
    ? convert_type(0,"L")
    = .F.
    ? convert_type("1","L")
    = .T.
    ? convert_type("0","L")
    = .F.
    ? convert_type(.T.,"N")
    = 1
    ? convert_type(.F.,"N")
    = 0
    ? convert_type("False","L")
    = .F.
    ? convert_type("True","L")
    = .T.
    ? convert_type(.T.,"C")
    = "True"
    ? convert_type(.F.,"C")
    = "False"
    Last edited by Stan Mathews; 09-21-2017 at 01:13 PM.
    There can be only one.

  5. #5
    Member
    Real Name
    Judith Donoghue
    Join Date
    Jun 2006
    Location
    Formby, UK
    Posts
    196

    Default Re: Calculated field in a browse table

    Thank you Stan - where would we be without you. I have included the expression in the browse table and it works a treat.

Similar Threads

  1. Calculated field and groups in a browse table
    By Judith in forum Alpha Five Version 11 - Desktop Applications
    Replies: 3
    Last Post: 07-24-2017, 10:57 AM
  2. Set calculated field in browse
    By Farren in forum Alpha Five Version 11 - Desktop Applications
    Replies: 2
    Last Post: 02-20-2012, 06:17 PM
  3. Calculated field in table - field rules - to update existing records when saved?
    By WendyWelton in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 01-18-2012, 07:18 PM
  4. Replies: 1
    Last Post: 08-15-2010, 11:06 PM
  5. Calculated fields - table vs browse
    By ABRIO in forum Alpha Five Version 8
    Replies: 3
    Last Post: 03-28-2008, 07:41 PM

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
  •