Author Topic: Reading Listscreen Data into Array  (Read 6972 times)

Sai Siddhartha

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 47
    • View Profile
Reading Listscreen Data into Array
« on: September 20, 2017, 10:04:20 AM »
Purpose:
Reading data from listscreen into array.

In Below example data from column "Document" of listscreen is read into an array by using position in set command.

LiquidUI Code:
/////////////////////////////////// RVKRED01.E0120.sjs ////////////////////////////////

pushbutton( [TOOLBAR], "scroll  ",{ "process": z_readfromlist }); // pushbutton to call function

function z_readfromlist(){ // function to reading data from listscreen and assign it to array
    z_doc = []; // array to store data
    lfvrow = 1;

    onscreen 'RVKRED01.0120'
        SCROLL_NEXT:;
        enter("/scrolltoline=&V[lfvrow]"); // scroll the list vertically

    onscreen 'RVKRED01.0120'
        enter("/hscrollto=0"); // scroll list horizontally

     // goes to end of function when end of listscreen is reached
     if(lfvrow >= _listlastvisiblerow){
          goto END;
     }

    START:;
    lfvrow = _listfirstvisiblerow;
    llvrow = _listlastvisiblerow;
    z_row = 3;

    LOOP:;
    // column data read into variable using position on screen
    set("V[doc_val]","&#["+z_row+",30]");
    z_doc.push(doc_val); // data from variable pushed into array
    lfvrow = lfvrow+1;
    if(lfvrow <= _listlastvisiblerow){ // fetches data from next row
      z_row = z_row+1;
      goto LOOP;
    }
    else{ // navigates to scroll code if end of screen is reached
      goto SCROLL_NEXT
    }

    END:;
    for(j=0;j<z_doc.length;j++){ // display array elements on cornelius output window
         println("document number at z_doc["+j+"]="+z_doc[j]);
    }
}
You can view data from document column of listscreen on cornelius output window.

See attachment for screenshots
« Last Edit: March 04, 2019, 09:51:19 AM by Rahul Gera »