Please do not use "IF AddressG."Customer Type" = 3 (Integer Value)" - it is widely accepted that this is bad practice and makes code difficult to read/understand. I know it exists in a few places in standard NAV code but that doesn't mean we should do it. Imagine if the posting routines (e.g. CU 12, 22) used this format - it would be a nightmare to try to understand that code.
i want to Generate Sales Register by using Location filter , posting Date filter and Tax type Filter .
Location And Posting filter successfully working but tax type filter not work.
code like RecPurchaseHeader - OnPreDataItem()
RecCompany.GET;
TxtDateFilter := '';
txtLocationfilter :='';
IF RecPurchaseHeader.GETFILTER("Posting Date") <> '' THEN
TxtDateFilter := 'Purchase Period ' +RecPurchaseHeader.GETFILTER("Posting Date")
ELSE
TxtDateFilter := 'Purchase Register';
IF RecPurchaseHeader.GETFILTER("Location Code") <> '' THEN
txtLocationfilter := 'Location Filter :- ' +RecPurchaseHeader.GETFILTER("Location Code")
@Mohit_B1 - The last IF statement should be something like this...
recdetail2."Tax Type" := recdetail2."Tax Type"::"CST"; // NOTE - new record variable required here
IF recdetail.GETFILTER("Tax Type") = FORMAT(recdetail2."Tax Type") THEN
...Note you need to create a new variable recdetail2 because in most versions of NAV FORMAT("Tax Type"::"CST") would give you the positional value as a text and not the option value as a text
P.S. You should not hijack an existing post like this - you should create your own separate post
Answers
IF AddressG."Customer Type" = 'Male' THEN BEGIN
but it doesn't work...
and also make an assignment like
IF AddressG."Customer Type" = 'Male' THEN BEGIN
AddressSurnameG."Customer Type"::"Male";
IF AddressG."Customer Type" = AddressG."Customer Type"::"Male" THEN BEGIN
OR ELSE
IF AddressG."Customer Type" = 3 (Integer Value)
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
i want to Generate Sales Register by using Location filter , posting Date filter and Tax type Filter .
Location And Posting filter successfully working but tax type filter not work.
code like RecPurchaseHeader - OnPreDataItem()
RecCompany.GET;
TxtDateFilter := '';
txtLocationfilter :='';
IF RecPurchaseHeader.GETFILTER("Posting Date") <> '' THEN
TxtDateFilter := 'Purchase Period ' +RecPurchaseHeader.GETFILTER("Posting Date")
ELSE
TxtDateFilter := 'Purchase Register';
IF RecPurchaseHeader.GETFILTER("Location Code") <> '' THEN
txtLocationfilter := 'Location Filter :- ' +RecPurchaseHeader.GETFILTER("Location Code")
IF recdetail.SETFILTER("Tax Type",'<>%1',"Tax Type"::'CST') THEN
txtCSTVAT := 'CST Filtering ' + RecDetails(RecDetails."Tax Type"::CST)
ELSE
txtCSTVAT := 'CST Filtering ' + RecDetails(RecDetails."Tax Type"::VAT);
...Note you need to create a new variable recdetail2 because in most versions of NAV FORMAT("Tax Type"::"CST") would give you the positional value as a text and not the option value as a text
P.S. You should not hijack an existing post like this - you should create your own separate post