Hello!
I’m Dynamics NAV newbie and this is my first post here.
I’m using NAV for only around a month now, so, it’s quite possible I’m asking something stupid here.
I’m just an end user (so, no Application Builder or Solution Developer licence) , using NAV version 5.0 SP1.
I’m building a new report. When report is run, a user selects “Location Code” value from “Value Entry” table, in order to show items sold only from a specific location.
That filter (along with others) is shown on top of the report (as in many other built in reports) with this code in Report - OnPreReport() section:
VEFilter := "Value Entry".GETFILTERS;
What I wanted to do is to show actual location name instead of the code for that specific location. So, my actions were like this:
- I wanted to get only “Location Code” number and not the whole filter name (e.g. something like ‘Location Code: 300’), so I added a global variable of text type named filt and this code:
filt := "Value Entry".GetFilter("Location Code");
in order to get only the number (e.g. 300). Is this a correct way to do this or should I parse string or something else?
- next, I wanted to read from “Location” table (number 14 table) the name of the location corresponding to the location code I got through filtering, so I created a global variable named loc of type record and subtype Location table, and did this in Report - OnPreReport() section, too (nn is code typed global variable I used to store location code got in previous step, locname is a text type global variable used to store location name):
Evaluate(nn, filt);
loc.SetRange(loc.Code, nn);
locname := loc.Name + loc."Name 2";
and then I set the SourceExpr propertie of an appropriate text box to locname.
When I run the report, the text box is empty. It seems that no data is actually pulled from “Location” table. There is probably my mistake. I tried some stuff I have found on this and other forums, but I got nothing. It must be something really stupid I did.
Please, help if you can, I’d really appreciate it.
Thank you,
Bojan Milosevic