Newbie needs help with "A value or expression was expected."

bboo4dbboo4d Member Posts: 14
I have created the following code. I am just trying to return a variable in a report.

The two tables are the tables in my report the variable I am trying to get is in the main table and I want to use it on a line in the body of the secondary table.


IF [Item Ledger Entry]."Item No_" THEN BEGIN
PubDateV := [Item]."Publication Date";

End;

I get the error ""A value or expression was expected." For example
100
myvar
myvar = 100

Thanks for your help

Comments

  • bbrownbbrown Member Posts: 3,268
    An IF..THEN statement expects a statement that can be evaluated to a Boolean. The statement "[Item Ledger Entry]."Item No_" cannot. You need to specify what [Item Ledger Entry]."Item No_" should be equal to.

    Example

    IF [Item Ledger Entry]."Item No_" = 'ITEM' THEN
    ...{do this]
    There are no bugs - only undocumented features.
  • slmaluwaslmaluwa Member Posts: 358
    Or
    If you are trying to see whether "Item No_" contains a value, use a function like
    STRLEN(String)
    
    to check it

    Ex:
    IF STRLEN([Item Ledger Entry]."Item No_") > 0 THEN BEGIN
    PubDateV := [Item]."Publication Date";
    
    End;
    

    There could be other ways also. Main point here is the IF statement expects a BOOLEAN result. TRUE or FALSE
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • bboo4dbboo4d Member Posts: 14
    Thanks for the input guys, I have tried both methods and am still getting the error message.

    Any other suggestions.

    Barb
  • kapamaroukapamarou Member Posts: 1,152
    Is this C/AL??? Why [Item Ledger Entry]."Item No_" and not
    "Item Ledger Entry"."Item No." ??

    Am I missing something?
  • SavatageSavatage Member Posts: 7,142
    bboo4d wrote:
    Thanks for the input guys, I have tried both methods and am still getting the error message.
    Any other suggestions.
    Barb

    Lets see your code & error messages. And I agree with kapamarou
    I was wondering the same thing (syntax?).
  • catiamatos1991catiamatos1991 Member Posts: 158
    I'm trying to set in my report a expression depending of a boolean but i cant linked the expression to my global var aux.

    proforma Boolean
    aux Text

    To turn around this problem I tried to create a column and with a/c code I set the column value depending of a boolean

    0yex0qidxzca.png

    anyone can help?
  • Jan_VeenendaalJan_Veenendaal Member Posts: 206
    [Why didn't you start a new thread, instead of adding to a 9-year-old one?]

    Is ReportTitle a Global Variable ? What type?
    Jan Veenendaal
Sign In or Register to comment.