Suppose if there are 54 columns we can loop through using:
DO WHILE cnt < 54: ( means 54 columns in the browse)
============================================
In the same way can we loopthrough the thing dynamically using Num-Entries(....)
If So pls explain the same.
Something like this should do the trick:
DEF VAR hBrowse AS HANDLE.
DEF VAR hColumn AS HANDLE.
...
hColumn = hBrowse:FIRST-COLUMN.
DO WHILE VALID-HANDLE(hColumn):
hColumn = hColumn:NEXT-COLUMN.
END.
or to directly reference a certain column by using column index:
hColumn = hBrowse:GET-BROWSE-COLUMN(col-index).
Thanks for ur reply Marko.
I wil explain my query below.
DEFINE VARIABLE loc_Width_tmp AS INTEGER NO-UNDO EXTENT 54.
DEFINE VARIABLE tempdata AS CHARACTER INITIAL '1' NO-UNDO.
DEFINE VARIABLE cnt AS INTEGER INITIAL 1 NO-UNDO.
OUTPUT STREAM a TO VALUE( i_filnamn ).
repeat while i
for each printdata where printdata.column = i no-lock.
if length(printdata.data) > length(tempdata) then
tempdata = printdata.data.
else.
i = i + 1.
end.
end.
==============================================
In the above example I did a sample code till 54 columns.
Now i have to make it a generic one. ie i should replace 54 with generic code since the columns of the browse will not be fixed through out the application.
Hw can it be done ?
I'm not sure if I understand your need but if you simply need the number of columns of a browse, you can get it with hBrowse:NUM-COLUMNS.
So you could use it like this:
do i = 1 to hBrowse:NUM-COLUMNS:
for each printdata where printdata.column = i no-lock.
if length(printdata.data) > length(tempdata) then
tempdata = printdata.data.
else.
end.
end.
And you can define extent variables dynamically like this:
DEFINE VARIABLE loc_Width_tmp AS INTEGER NO-UNDO EXTENT.
EXTENT(loc_Width_tmp) = hBrowse:NUM-COLUMNS.
Hope this helps.
Perfect Marko !!! This was the kind of thing i was trying for !
Thanks