Is there a special variable that needs to be

Michaellee
Member Posts: 65
Hi all,
I am trying to find all the unique SOs' for an item that it is reserved for.
e.g Item 1234 has some stock reserved for SO1234 and SO1235 but the stock is in multiple bins and thus there are more than one reservation entry for each SO. I want to be able to place the SO number in a text field to display on a report, so the result I am looking for is "SO1234, SO1235".
I have used some code:
Variable
arrays Text 100
x Integer
y Integer
SOCollate Text 250
Res Record Reservation Entry
Code
x:=1;
y:=0;
IF Res.FIND('-') THEN
REPEAT
arrays[x] := Res."For ID";
repeat
if arrays[y] = Res."For ID" THEN
Test=TRUE;
UNTIL y=x-1 OR Test=TRUE;
IF Test = FALSE Then
SOcollate := SOcollate + ', ' + Res."For ID";
UNTIL rES.NEXT=0;
My issue is that when I try to compile, I get the error message 'Type conversion not possible because 1 of the operators contains an invalid type, Char:= Code'
Am I missing something?
Many thanks for any help.
Mike
I am trying to find all the unique SOs' for an item that it is reserved for.
e.g Item 1234 has some stock reserved for SO1234 and SO1235 but the stock is in multiple bins and thus there are more than one reservation entry for each SO. I want to be able to place the SO number in a text field to display on a report, so the result I am looking for is "SO1234, SO1235".
I have used some code:
Variable
arrays Text 100
x Integer
y Integer
SOCollate Text 250
Res Record Reservation Entry
Code
x:=1;
y:=0;
IF Res.FIND('-') THEN
REPEAT
arrays[x] := Res."For ID";
repeat
if arrays[y] = Res."For ID" THEN
Test=TRUE;
UNTIL y=x-1 OR Test=TRUE;
IF Test = FALSE Then
SOcollate := SOcollate + ', ' + Res."For ID";
UNTIL rES.NEXT=0;
My issue is that when I try to compile, I get the error message 'Type conversion not possible because 1 of the operators contains an invalid type, Char:= Code'
Am I missing something?
Many thanks for any help.
Mike
0
Answers
-
Hi Michael,
The compiler is picking up that you are using a char from the string "arrays". To make it into an array you need to set the dimensions property on the variable.
You could also solve it in the report with grouping or using the currreport.showoutput on the section0 -
Are you sure that you set the Dimension property of the variable "arrays"? It seems that not and thus the indexing leads to single character of the string and not the x-th element of the array... 8)0
-
Thanks the help guys. Can you p[ossibly tell me what to set the dimension to? I am a relative newbie to the development scene and can't seem to find literature on how to start developing...
Mike0 -
Thanks the help guys. Can you p[ossibly tell me what to set the dimension to? I am a relative newbie to the development scene and can't seem to find literature on how to start developing...
Mike0 -
Hi Mike,
The dimension would have to be set greater than the number of orders returned - depends on data. I would advise you to use showoutput commend in the report which you can control.
e.g.
in the OnPreSection() on the section of the report add in somthing like
currreport.showoutput( oldSOcode = Res."Source Ref. No." );
oldSOcode := Res."Source Ref. No.";
This dataitem will need the sorted by Source ref. no. for this to work.0 -
Open the variables window (locals or globals work the same), put your cursor on the variable that you want to define as a variable, then open the properties window. The dimension property is the last one on that little list. The value represents the maximum number of elements in your array.0
-
Because you are using "array[x]" I thought that you know how the arrays are set in NAV - in the Dimension property you can set max. no. of elements for each dimension . For more info and example, please press F1 when standing on the Dimensions property.0
-
Thanks for all the helpful posts. I have now worked out where I was going wrong. Thanks again!
Mike0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions