On paginating data:
This can be done a few different ways, but the most efficient would probably be to store the results from your LIST_OBS expression into an array and then paginate the values out into a separate array for the purpose of displaying it on your form. You could use a previous and next button to step through the "pages" of your data. You can get your data into the first array by using this command:
arrValues = getfield(OBS_LIST("DMARD","Signed","list","valuedate"),"\r","")
You can then determine the number of pages you will need by dividing the number of values in the array above by the number of items you will want to display on each page (note: you can use the div() and mod() functions to identify the total number of pages). Something like this:
numValues = size(arrValues)
itemsPerPg = 10
if mod(numValues,itemsPerPg) <> 0 then
numPages = div(numValues,itemsPerPg) + 1
else
numPages = div(numValues,itemsPerPg)
endif
You can then store each "page" of data (10 items per page in this example) in a separate array by creating a pipe delimited list of all the items on each page. For example, let's say you called your pagination array "pageData" and the total number of values in the "arrValues" array defined above was 32, your pageData array would have 4 records (4 pages of data) as follows:
pageData(0): val1 (date1)|val2(date2)|val3 (date3)|....|val10(date10)
pageData(1): val11 (date11)|val12(date12)|val13 (date13)|....|val20(date20)
pageData(2): val21 (date21)|val22(date22)|val23 (date23)|....|val30(date30)
pageData(3): val31 (date31)|val32(date32)
You will likely need to use nested "for loops" to create your pageData array, but once that is done, you could set up <next> and <previous> buttons on your form that would display the appropriate page of data when they were clicked. I would store the current page number in a hidden variable and then increment/decrement the page number variable based on the button that was clicked (next/previous). You could then update the data display based off of the corresponding array index (i.e. current page number -1). You could have a function that converts the corresponding pageData row (pipe delimited values) into a nice formatted list in the data display.
I hope this provides some insight. I would have provided more code, but I'm slammed today. In any event, this should get you pointed in the right direction. Perhaps someone has written a pagination function for just this purpose that they will post.
Posted : September 5, 2018 6:55 am