how to do Looping in looping?
bangswit
Member Posts: 265
hi all
i want to do looping in looping
how to do that?
on pre data item
in section (report)
i already done like this
Location 1 Location 2 Location 3 Location 4 Location 5
but all i want is to be like this
Location 1 Location 2 Location 3
Location 4 Location 5
so i create code like this
i want to do looping in looping
how to do that?
on pre data item
Item - OnPreDataItem()
Location.FIND('-');
i:= 1;
REPEAT
LocName := Location.Code;
i:= i +1;
UNTIL
(Location.NEXT=0) OR (i>Location.COUNT);
in section (report)
i already done like this
Location 1 Location 2 Location 3 Location 4 Location 5
Location.FINDFIRST;
n :=0 ;
REPEAT
n := n+1;
XLRow(FORMAT(LocName[n]));
ExcelBuf.NewRow;
UNTIL Location.NEXT= 0;
but all i want is to be like this
Location 1 Location 2 Location 3
Location 4 Location 5
so i create code like this
--> Failed
Location.FINDFIRST;
n :=0 ;
REPEAT
n := n+1;
FOR x:=1 TO 3
DO
XLRow(FORMAT(LocName[n]));
NEXT;
ExcelBuf.NewRow;
UNTIL Location.NEXT= 0;
0
Comments
-
Location.FINDFIRST;
n := 0;
REPEAT
n += 1;
FOR x:= n TO n+3 DO BEGIN
XLRow(FORMAT(LocName[x]));
END;
ExcelBuf.NewRow;
UNTIL Location.NEXT= 0;
You might wanna add something like:
IF Arraylen(LocName) > X THEN
XLRow(FORMAT(LocName[x]));0 -
Nope
it's still wrong
your code make my report like this
Location 1 Location 2 Location 3 Location 4
Location 2 Location 3 Location 4 Location 5
Location 3 Location 4 Location 5
Location 4 Location 5
Location 50 -
I'm sorry?Belias wrote:what do you want to achieve, in simple words?
write only in columns A,B,C and then change row?
i don't know what you mean...
i want to create reports Item By Location
because the location is too many to sideways
so i want to limit it only 3 location sideways
the remains is show below it...0 -
you're writing in an excel file, isn't it?
so, if you have 6 location, you want to write the first three in the first three columns in excel (A,B,C) and then write the rest of the location in the second row of excel0 -
(i don't know the structure and purpose of the report, but my first guess is to do)
onprereportrownumber := 1; colnumber := 0;
location - onaftergetrecordif colnumber > 3 then begin rownumber += 1; colnumber := 1; end else colNumber +=1; //write in excel cell with position rownumber,colnumber <-- i use a custom function for this. when i've time, i'll post it...anyway, it is a popular function that you can find on mibuso
for the function try to search "FALSE,FALSE,FALSE" in mibuso, you'll probably find it..0 -
BTW:
NEVER USEIF FINDFIRST THEN REPEAT UNTIL NEXT = 0;
but use:IF FINDSET THEN // or FIND('-') or FIND('+') REPEAT UNTIL NEXT = 0;see also this for more info : http://www.mibuso.com/howtoinfo.asp?FileID=22Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Belias wrote:(i don't know the structure and purpose of the report, but my first guess is to do)
onprereportrownumber := 1; colnumber := 0;
location - onaftergetrecordif colnumber > 3 then begin rownumber += 1; colnumber := 1; end else colNumber +=1; //write in excel cell with position rownumber,colnumber <-- i use a custom function for this. when i've time, i'll post it...anyway, it is a popular function that you can find on mibuso
for the function try to search "FALSE,FALSE,FALSE" in mibuso, you'll probably find it..
eiy i already got the answer
just like thisColumn:=4;
Location.FINDFIRST;
n :=0 ;
REPEAT
x := n MOD Column;
n := n+1;
IF x = 0 THEN
BEGIN
ExcelBuf.NewRow;
FOR EmptySpace := 1 TO 7 DO
BEGIN
XLRow('');
END;
END;
XLRow(FORMAT(LocName[n]));
UNTIL Location.NEXT= 0;
thanks for any help \:D/0 -
kriki wrote:BTW:
NEVER USEIF FINDFIRST THEN REPEAT UNTIL NEXT = 0;
but use:IF FINDSET THEN // or FIND('-') or FIND('+') REPEAT UNTIL NEXT = 0;see also this for more info : http://www.mibuso.com/howtoinfo.asp?FileID=22
ok
thanks a lot kriki
for the info0 -
bangswit,
please use Code tags for posting code, not Quote tags. It makes the code much easier to read because indentation is preserved.0 -
owww ok2
sorry about thattest
0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
