Patti,
First of all -- this isn't exactly related to the question you've asked, but... your [empname] fields in the output widgets in your subfile will always be blank (as far as I can tell.)
This is a little tricky to explain, so please forgive me if I over/under explain it, just trying to put my thoughts together, here... When you use the sql ("database-driven") properties to load a grid, the data goes into the grid itself. I know that sounds weird... but the "bound fields" (like 'empname') are for data written from your RPG program only. When data is automatically loaded from the database files there's no need for these bound properties and they are not used. Data is just put directly into the cells themselves without any other widgets.
So with the way you have it now, you'll have these [empname] output fields in the grid, but they will be blank. Since they have no backgrounds assigned to them, they will be "invisible" (you'll be able to see through them.) And you'll be able to see the SQL loaded data which will be "behind" them in the grid.
Hope that makes sense... the [empname] fields won't stop things from working. They're just superfluous and not used.
Second point...
When you bind a field to a property, the data is loaded into that property when your screen is rendered. (i.e. before the screens 'onload' event.) So the 'parameter value' property of your grid is set from the 'position' field when the screen is rendered. This will not change when the user types into the textbox! So when you call the grid's refresh() method, it will re-run the exact same SQL statement that it ran when the display was loaded.
For performance purposes, Profound UI keeps track of the SQL statement, it's parameters, etc. If nothing has changed, it will keep using the data it has already loaded instead of re-running the statement. So really the refresh() call will redraw the grid from the data that PUI has already received from the server when the screen first loaded. This is why your "position" is not working.
We can fix this by using JavaScript to change the "parameter value" when the 'onchange' event fires. To do this, change the following:
- Make sure the textbox has an id of "POSITION" (this is case-sensitive. you can call it whatever you want, but the upper/lowercase must match). The "id" is what's used from JavaScript, not the bound field name.
- set the 'parameter value' property to: script: get("POSITION") -- this will also run only when the display is rendered... so it'll have the exact same effect as binding to the position field, except that now that it's not a bound field, it'll be something we can change with JavaScript.
- In the 'onchange' event (if that's when you want it to run) for the position textbox to applyProperty("PendingGrid", "parameter value", get("POSITION")); -- so this will change the parameter value when the user changes the field.
- On the next line of the 'onchange' (after the applyProperty) do the getObj("PendingGrid").grid.refresh(); (you already have this part -- just make sure it's after the applyProperty)
- Also, you should verify that the id of the grid widget is "PendingGrid" (again, match upper/lowercase exactly) if you haven't already.
You could also do the "applyProperty" and "refresh()" in the onclick of the magnifying glass if you wanted it to update when they click on that image.
Third point...
Instead of doing all of the stuff in the 2nd point, another alternative would be to submit the screen back to the RPG program, and have RPG do EXFMT again. In that case, you could keep the bound fields as-is, and just have onchange do "pui.click()" instead of refresh. Since control is sent back to the RPG program, the position bound variable will be updated, and the whole load/render process of the screen will be repeated, which will refresh the grid.
So the second point is only needed if you want to avoid sending control back to the RPG. (Which some do)
Fourth point....
You probably already know this, but just in case you didn't... the SQL statement doesn't really "position" the subfile Rather it will only load records into the subfile that are greater than your criteria. So you're saying "I only want records WHERE emname >= [position] and emsuspend='S'"
I'm assuming you know this already, but thought I should mention it just in case.
Anyway, hope that helps. Let me know if there's anything I can explain better.