The first bit of the if works fine for blank and no but if the option is yes the second bit wont even generate a page for the report, any help appreciated!
IF "VAT Number" = 0 THEN BEGIN
"Vat No X" := '';
"Vat No" := '';
END ELSE BEGIN
"Vat No X" := Text013;
"Vat No" := Text014;
END;
Comments
is VAT Number" = 0 an option field?
http://www.BiloBeauty.com
http://www.autismspeaks.org
you can test this
IF "VAT Number" = 0 THEN BEGIN
"Vat No X" := '';
"Vat No" := '';
END ELSE BEGIN
"Vat No X" := Text013;
message('%1',"Vat No X");
"Vat No" := Text014;
message('%1',"Vat No");
END;
If the valeus that pop up are correct you know you are simply not saving the new values.
Oh is this a REPORT?????
http://www.BiloBeauty.com
http://www.autismspeaks.org
perhaps Vat No is NEVER 1 are you getting it from another table or is it part of your main dataitem?
http://www.BiloBeauty.com
http://www.autismspeaks.org
Can you post the data type for each used variable?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Then on the report i have created two constants Text013 and Text014, i also created two global vars called "VAT No X" and "VAT No".
In the Sales Invoice Header - OnPreDataItem() trigger i've added the above if statement!?
Not sure if that helps?
VAT Number - option
VAT No - Text
VAT No X - Text
Is this a "real field" or just some variable on the form?
2nd if you don't create the same "real field" in the "Sales invoice header" with the same number, it won't transfer over. therefore it doesn't exist.
:-k :-k
oh! 3rd if this field is just about being Yes or No - well that's exacty what a boolean type field is for.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Now I'm real confused. How do you select anything in a preview of a report?
Do you mean you have a request form?
FYI - boolean fields are made for true/false oryes/no, not options.
http://www.BiloBeauty.com
http://www.autismspeaks.org
I have changed it to be a boolean in the Sales invoice header table, i have found that when i leave the vat number field blank, no or yes it is passing no from the request form everytime?!
Do i have to reference the Vat Number var in the sales invoice header somewhere else in the report or something?
I appreciate all your help by the way!
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
1) How you are setting the value of the variable on the request page?
2) Check if there is no local variable with same name...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I understand what your saying and i appreciate your comments, but i would have thought it easy enough to be able to populate a global var with a string based on a no/yes option on the request form which would affect the outcome of the report when its just a var thats assigned to a textbox!
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
FYI-Sometimes it really pays to post in detail what you want to to. else we have to keep posting to try an narrow down the goal.
Now this field does it exist in the actual table? or did you create a variable in the report only?
If it's in the actual table how did you switch it to a boolean so quickly.
You would have had to clear any that ahad a value. So perhaps noting has a value therefore all = 0
You know what i mean?
http://www.BiloBeauty.com
http://www.autismspeaks.org
Did you know you can use a boolean type field/variable for this purpose? Did you know that by entering this boolean type as the source of a control, it will automatically be displayed as 'yes' or 'no'? C/AL will also be much easier, because a boolean, by its nature, evaluates to TRUE or FALSE, which are the two values possible in an IF statement.
RIS Plus, LLC
RIS Plus, LLC
[code]IF "VAT Number" = "VAT Number"::No THEN BEGIN
"Vat No X" := '';
"Vat No" := '';
...[code]
Also I second what is being said: the piece of code you posted is correct. The reason that you are not getting the expected result is because "VAT Number" is not initialized correctly... somewhere