Page 1 of 1

access to qtemp file for grid

Posted: Fri Jan 27, 2012 4:16 pm
by leatherlips
In an rpg program, I want to build a database file in qtemp, and have that file bound to a grid when the screen is displayed.
For some reason, when I run the program, the data is not showing in the grid. I can see in the joblog that the records are copied into the "qtemp/filename" (which is what is used in the database file property of the grid).
RPG - calls a cl that creates the file in qtemp (crtdupobj from existing file), then a simple cpyf is used to populate the data into the QTEMP file.
the RPG then executes the format to display the grid. The grid shows no data, but the "rows" when I scroll down indicate 92 items are in the grid.
Should this work?

Re: access to qtemp file for grid

Posted: Fri Jan 27, 2012 5:55 pm
by leatherlips
ALSO, I just tried to use the named file in standard (non-qtemp) library, but use a member of the file to segregate the data. In this test, I used a wrapper -CL to ovrdbf to a specific member, then call the RPG which displays the grid bound to the PF (overriden to proper data I had hoped). This doesn't seem to display data either.

Re: access to qtemp file for grid

Posted: Wed Feb 01, 2012 11:54 am
by Brian
When using the grid properties to automatically fill a grid from a file, the page makes an AJAX request to retrieve the data from the file after the screen is loaded. This will always go to another webserver job, so things like QTEMP and OVRDBF won't apply since you are in a different job.

If you need to limit the data for the grid, the "Selection Criteria" property can help you do so. It is basically the "WHERE" clause of the SQL statement used to retrieve the data. If you need something more complex than a simple where clause, the "Custom SQL" property will allow you to write your own SQL statement to retrieve the data for the grid.

Re: access to qtemp file for grid

Posted: Wed Feb 01, 2012 10:57 pm
by leatherlips
Thanks Brian, we're trying to build some things like links and urls into the grids that are program created, and thought the qtemp way might help us along with helping to implement filtering and such when building the grid data. I'm not sure I can use SQL to build the data elements I"m trying to build (at least not with my sql expertise). I'll look further to see if there's anyway SQL could do what I need.

Also, if the Grid is using Ajax requests from the front end, is it possible for Profound Logic to implement a way to do column filtering (where the user can input a filter on a column, and have the data refreshed with the filter applied)?

Re: access to qtemp file for grid

Posted: Thu Feb 02, 2012 10:39 am
by Brian
I can certainly bring it up during our next staff meeting. Could be a cool feature.

Of course, you could accomplish this yourself if you put a text box over the columns to be filtered. You could then use some javascript to dynamically build your where clause in the grids properties.

Re: access to qtemp file for grid

Posted: Thu Feb 02, 2012 10:48 am
by leatherlips
I'll have to try that again I thought once the grid was displayed(screen was displayed) I'd have to make another round trip to the iseries to apply the where clause (or custom SQL). I was wanting to see if the properties (selection) could be applied in the front end without returning to the server(with my program) since the grid is using an Ajax request.

Re: access to qtemp file for grid

Posted: Thu Feb 02, 2012 11:01 pm
by leatherlips
also, if I'm adding to the wish list on the grid, since we cant use an ovrdbf (do to the Ajax rqst being processed in a separate job), is there a way to specify a file member (of a multi-member database file) in the properties of the grid?

Re: access to qtemp file for grid

Posted: Fri Feb 03, 2012 11:45 am
by Brian
Well, the grid uses SQL to access the data. SQL doesn't do members. What you would have to do is create an SQL alias. This can point to a specific member. So for example:

CREATE ALIAS LIBRARY.NAME FOR LIBRARY.FILE (MEMBER)

Then you would use the new alias (NAME in the above example) instead of the file name. The alias will only show data for the member it points to. This is a one time thing, so you don't need to do it in your program. Once you run the CREATE ALIAS statement it will create an object (which is actually a DDM file) in your library with the name you specified.

Re: access to qtemp file for grid

Posted: Fri Feb 03, 2012 12:19 pm
by leatherlips
Great Tip Brian. That will help in a few instances where we have multi-member files.

THANKS