code problem

mkpjsr
Member Posts: 587
Hi all
i want to fetch the "No. 2" field from Item table into an array under "Transfer Shipment Report", so i have written the following code to do so but not able to fix it,
globals i have used:
i->Int
TransShipLine->Rec->Transfer Shipment Line
ItemRec->Record->Item
ItemNo->Text array
i:=1;
IF TransShipLine.FINDSET THEN
REPEAT
ItemRec.GET("Item No.");
ItemNo:=ItemRec."No. 2";
i+=1;
UNTIL TransShipLine.NEXT=0;
here the dimension of the array is 6 and when i am running the report am getting an error
"The indexing 7 in the array is outside of the permitted range"
what is wrong with the code. can anybody help me
i want to fetch the "No. 2" field from Item table into an array under "Transfer Shipment Report", so i have written the following code to do so but not able to fix it,
globals i have used:
i->Int
TransShipLine->Rec->Transfer Shipment Line
ItemRec->Record->Item
ItemNo->Text array
i:=1;
IF TransShipLine.FINDSET THEN
REPEAT
ItemRec.GET("Item No.");
ItemNo:=ItemRec."No. 2";
i+=1;
UNTIL TransShipLine.NEXT=0;
here the dimension of the array is 6 and when i am running the report am getting an error
"The indexing 7 in the array is outside of the permitted range"
what is wrong with the code. can anybody help me
0
Answers
-
mkpjsr wrote:Hi all
i want to fetch the "No. 2" field from Item table into an array under "Transfer Shipment Report", so i have written the following code to do so but not able to fix it,
globals i have used:
i->Int
TransShipLine->Rec->Transfer Shipment Line
ItemRec->Record->Item
ItemNo->Text array
i:=1;
IF TransShipLine.FINDSET THEN
REPEAT
ItemRec.GET("Item No.");
ItemNo:=ItemRec."No. 2";
i+=1;
UNTIL TransShipLine.NEXT=0;
here the dimension of the array is 6 and when i am running the report am getting an error
"The indexing 7 in the array is outside of the permitted range"
what is wrong with the code. can anybody help me
Dimension of the array is 6 but TransShipLine.FINDSET finds more than that so you are facing the error.Now or Never0 -
mkpjsr wrote:here the dimension of the array is 6 and when i am running the report am getting an error
"The indexing 7 in the array is outside of the permitted range"
You've solved your own problem. You know that your array can only hold six values, but you are trying to assign something in the 7th spot. That 7th spot doesn't exist so the error is thrown.
Either increase the size of your array or add conditions to your REPEAT..UNTIL loop to account for finding more than you need.0 -
Here the line contains only two items so i think in the array i will have not more than two values at a time. I had also tried increasing the size of the array but i am getting the same error
"The indexing n+1 in the array is outside of the permitted range". I think there is some problem with filtering0 -
Here the line contains only two items so i think in the array i will have not more than two values at a time. I had also tried increasing the size of the array but i am getting the same error
"The indexing n+1 in the array is outside of the permitted range". I think there is some problem with filtering0 -
Since I don't see any filters in the code you posted I would say you are probably correct. Also, I didn't say what you have me quoted as saying. Please edit your response.0
-
Why are you using an array. You will always get this issue eventually one day. Use a Temporary table.David Singleton0
-
David Singleton wrote:Use a Temporary table.
Can u please focus on this. should i use Integer table, if yes then how0 -
i:=1;
IF TransShipLine.FINDSET THEN
REPEAT
ItemRec.GET("Item No.");
ItemNo:=ItemRec."No. 2";
i+=1;
UNTIL TransShipLine.NEXT=0;
there needs to be filters on transShipLine to findset for the specific rec
also
ItemRec.GET("Item No.");
should be
ItemRec.GET(TransShipLine."Item No.");
Steve Post0 -
SPost29 wrote:i:=1;
IF TransShipLine.FINDSET THEN
REPEAT
ItemRec.GET("Item No.");
ItemNo:=ItemRec."No. 2";
i+=1;
UNTIL TransShipLine.NEXT=0;
there needs to be filters on transShipLine to findset for the specific rec
also
ItemRec.GET("Item No.");
should be
ItemRec.GET(TransShipLine."Item No.");
Steve Post
thanx, i got it and the problem is resolved0
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