#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    9
    Rep Power
    0

    Trying to get a list of ticked items onto a report.


    I am trying to create a report that will show only the "ticked" items in our system, unfortunately the report uses delphi for calculations as such and I'm very new to delphi.

    Im not sure if I can do what i need to do with Delphi.
    I was thinking along the lines of : IF or maybe IFTHEN
    Any help would be fantastic.
    What i started working with, not sure if its right (mostly likely not).


    begin

    IF LOGO1['TYPE']=y then Text := 'Logo1'
    And or else
    IF LOGO2['TYPE']=N then Next
    And or else
    IF LOGO3['TYPE']=y then Text := 'Logo3'
    And or else
    IF LOGO4['TYPE']=N then Next
    And or else
    IF LOGO5['TYPE']=y then Text := 'Logo5'
    And or else
    IF LOGO6['TYPE']=N then Next
    And or else
    IF LOGO7['TYPE']=y then Text := 'Logo7'

    end;
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    9
    Rep Power
    0
    I have just tried this as well but still my system doesn't like it.

    begin
    if (DR_TRANS['X_WEBLOGO2']= y then
    Value := 'Text2'
    else if DR_TRANS['X_WEBLOGO3']= y then
    value := ' Text3'
    else if DR_TRANS['X_WEBLOGO4']= y then
    Value := 'Text4'
    else if DR_TRANS['X_WEBLOGO5']= y then
    value := 'Text5'
    else if DR_TRANS['X_WEBLOGO7']= y then
    value:= 'Text7'
    else if DR_TRANS['X_WEBLOGO6']= y then
    Value := 'Text6'
    else if DR_TRANS['X_PROD_REG_PURCH']= y then
    Value := 'Text1'

    end;
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    356
    Rep Power
    7
    With the information provided, it would be very hard to help you. I'm not sure what you mean by "ticked", nor did you explain what DR_TRANS, X_WEBLOGO3, LOGOX, or TYPE is.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    9
    Rep Power
    0
    Originally Posted by majlumbo
    With the information provided, it would be very hard to help you. I'm not sure what you mean by "ticked", nor did you explain what DR_TRANS, X_WEBLOGO3, LOGOX, or TYPE is.
    I will change the DR Trans (which is the table) and Weblogo (which is a field) The field has a tick box on the console, so the only answers that come from weblogo is 'Y' if ticked.

    What i need to do, is if there is a Y give me the text, if there isnt a Y then dont give me anything, move onto the next one. And if there is a Y give me that text under the first text, etc.
    Hope that clears up a little?

    begin
    if (Table['Field2']= y then
    Value := 'Text2'
    else if Table['Field3']= y then
    value := ' Text3'
    else if Table['Field4']= y then
    Value := 'Text4'
    else if Table['Field5']= y then
    value := 'Text5'
    else if Table['Field7']= y then
    value:= 'Text7'
    else if Table['Field6']= y then
    Value := 'Text6'
    else if DTable['Field1']= y then
    Value := 'Text1'

    end;
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    356
    Rep Power
    7
    Originally Posted by Tymar
    I will change the DR Trans (which is the table) and Weblogo (which is a field) The field has a tick box on the console, so the only answers that come from weblogo is 'Y' if ticked.

    What i need to do, is if there is a Y give me the text, if there isnt a Y then dont give me anything, move onto the next one. And if there is a Y give me that text under the first text, etc.
    Hope that clears up a little?

    begin
    if (Table['Field2']= y then
    Value := 'Text2'
    else if Table['Field3']= y then
    value := ' Text3'
    else if Table['Field4']= y then
    Value := 'Text4'
    else if Table['Field5']= y then
    value := 'Text5'
    else if Table['Field7']= y then
    value:= 'Text7'
    else if Table['Field6']= y then
    Value := 'Text6'
    else if DTable['Field1']= y then
    Value := 'Text1'

    end;
    So this is a database application? Assuming so, and assuming you have a table component on your form, named TABLE1 that points to your DR_TRANS table, you can check the values of the fields like so

    if TABLE1.FIELDS[X].AsString = 'Y' then
    //where X is the integer index of the desired field

    or

    if TABLE1.FIELDBYNAME('<field name>').AsString = 'Y' then
    //where <field name> is the name of the desired field
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    9
    Rep Power
    0
    Originally Posted by majlumbo
    So this is a database application? Assuming so, and assuming you have a table component on your form, named TABLE1 that points to your DR_TRANS table, you can check the values of the fields like so

    if TABLE1.FIELDS[X].AsString = 'Y' then
    //where X is the integer index of the desired field

    or

    if TABLE1.FIELDBYNAME('<field name>').AsString = 'Y' then
    //where <field name> is the name of the desired field
    Yes sorry , its a SQL database.
    The Clarity report lets me draw tables and fields and also lets me create calculations.

    As there are multipliable field names I want listed under the same equation, should i be putting and or then.

    like below which i thought might be another way to go.

    If (Table['Field1'] = 'y') and (Table['Field2'] = 'y') and (Table['Field3'] = 'n') then
    Value := 'Field1 Field2'

    And on the report it would list :
    Field1
    Field2

    Not sure im on the right path.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    356
    Rep Power
    7
    Originally Posted by Tymar
    Yes sorry , its a SQL database.
    The Clarity report lets me draw tables and fields and also lets me create calculations.

    As there are multipliable field names I want listed under the same equation, should i be putting and or then.

    like below which i thought might be another way to go.

    If (Table['Field1'] = 'y') and (Table['Field2'] = 'y') and (Table['Field3'] = 'n') then
    Value := 'Field1 Field2'

    And on the report it would list :
    Field1
    Field2

    Not sure im on the right path.
    Sorry, it's difficult to solve your issues from here, mostly because, I don't fully understand what you want, but also, because, I never use any of the report packages with Delphi (They've changed too many times over the years and don't want to re-write all my reports when the next report engine is included). As far as the if statement you showed, you need to rewrite to something like:
    Code:
    If (Table.Fields[1].AsString = 'y') and (Table.Fields[2].AsString = 'y') and (Table.Fields[3].AsString = 'n') then
    Value := Table.Fields[1].AsString+slinebreak+Table.Fields[2].AsString;
    That's assuming "Table" is the name of the table component on your form, and you are checking the values in the 2nd, 3rd, and 3th columns in the table (Fields[0] points to the 1st column, Fields[1] points to the 2nd column, ...)
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    9
    Rep Power
    0
    Originally Posted by majlumbo
    Sorry, it's difficult to solve your issues from here, mostly because, I don't fully understand what you want, but also, because, I never use any of the report packages with Delphi (They've changed too many times over the years and don't want to re-write all my reports when the next report engine is included). As far as the if statement you showed, you need to rewrite to something like:
    Code:
    If (Table.Fields[1].AsString = 'y') and (Table.Fields[2].AsString = 'y') and (Table.Fields[3].AsString = 'n') then
    Value := Table.Fields[1].AsString+slinebreak+Table.Fields[2].AsString;
    That's assuming "Table" is the name of the table component on your form, and you are checking the values in the 2nd, 3rd, and 3th columns in the table (Fields[0] points to the 1st column, Fields[1] points to the 2nd column, ...)
    Thanks for trying, but the program doesn't like AsString
    keeps saying its an error.

IMN logo majestic logo threadwatch logo seochat tools logo