Setting lower limit of subfile display

Use this board to ask questions or have discussions with other Genie users.
Post Reply
FoxBill
Profound User
Posts: 38
Joined: Mon Jun 20, 2011 11:44 am
First Name: Bill
Last Name: Streit
Company Name: Fox Metro WRD
Contact:

Setting lower limit of subfile display

Post by FoxBill »

I was wondering if there is a simple way thru setting properties of Grid to load Subfile starting at a set lower limit.
Presently I added a grid to GENIE screen that is not in my RPG logic. I set to fill grid by loading a database file.
The grid loads and thru setting on Rowclick properties I am able to fill in text boxes with data from the grid row.
I however want to fill the grid Starting at a lower limit of a value I enter into a text box instead of the entire data file.
I was wondering if there is a solution to this thru the grid properties instead of having to add the subfile and logic to my RPG program.


Thanks Bill
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Setting lower limit of subfile display

Post by Scott Klement »

The "selection criteria" property determines which rows are loaded into your subfile. For security purposes, this property must be set in the designer before your display file is compiled -- but it can include "parameter markers", which are variables that can be supplied at run time.

So for example, selection criteria might be set to "MYKEY > 1000", and that would let you only load records where the MYKEY field value is higher than 1000 -- but this would be done every time you load the subfile. On the other hand, you could set the selection criteria to "MYKEY > ?" in this case the ? specifies a parameter marker -- a variable that can be determined at run-time. You can then set the "parameter value" property to something like "script: 1000", this tells it to only load values that are greater than 1000 when the display is first drawn.

You can now use the applyProperty() API to change the "parameter value" in JavaScript events. That way, you can change it at run time.
FoxBill
Profound User
Posts: 38
Joined: Mon Jun 20, 2011 11:44 am
First Name: Bill
Last Name: Streit
Company Name: Fox Metro WRD
Contact:

Re: Setting lower limit of subfile display

Post by FoxBill »

Actually I think i am looking for something a little simpler. Looking at what i am trying to accomplish I think there may be a simple answer.
I have Four Text boxes that have the fields for an address in them. Example Addr1, Addr2,Addr3 and Addr4 Where Addr1 is name Addr2 and 3 Addr are address and Addr4 City State. I have a File of Vendors that has these four fields. What I am hoping to do is use the Auto complete in the text box one. I start to type name and upon selecting a record from list of fields I would like to auto fill the 3 other textboxes also.
I tried to use getObj and changeElement value but i am not sure what to call the obj is it a grid or something Else.
I tried this logic in the onselect property

var sup2 = getObj(grid).grid.getCellValue(row,1);changeElementValue(I_14_12',sup2)
I tried that to fill the second textbox.
Text Box Data Properties
Text Box Data Properties
text box.gif (14.21 KiB) Viewed 1763 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Setting lower limit of subfile display

Post by Scott Klement »

Bill, the auto-complete function is really designed to only return the information for a single field. It sounds like you want to return all of the related information in the record instead of just the data for one field, which is not as easy. I think you might have to code your own AJAX calll to do that... hmmm... let me think on that.
User avatar
Alex
Profound Logic Staff Member
Posts: 233
Joined: Fri Jan 04, 2008 12:10 pm
First Name: Alex
Last Name: Roytman
Company Name: Profound Logic Software
Contact:

Re: Setting lower limit of subfile display

Post by Alex »

Scott/Bill... the following info may help:

Onselect (http://www.profoundlogic.com/docs/displ ... Textbox%29) - this JavaScript event provides the fields of a selected auto-complete entry, which you can use to populate other fields on the screen using pui.set().

With this, however, you will need to specify all necessary fields as choice option fields. To format them nicely, you may need to use HTML in the "results template" property. See bottom of this page for a simple example: http://www.profoundlogic.com/docs/display/PUI/Textbox.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Setting lower limit of subfile display

Post by Scott Klement »

Perfect!

Bill, I must apologize. It seems you were on the right track, and I was the one who was not in-the-know, here.

So what you're missing, I think, is that you don't know how to get the field data. (For some reason, you're using a grid function, but that doesn't apply here... that's for working with subfile grids.)

What you want to do is create a Javascript function. For example, you could add it right on to the end of the code in the custom.js file for your Genie skin, and it could look like this:

Code: Select all

function address_selected(parm) {
   changeElementValue("I_14_12", parm.POSUP2);
   changeElementValue("I_15_12", parm.POSUP3);
   changeElementValue("I_16_13", parm.POSUP4);
}
Mind you, I don't know which fields on your display are the ones you want to fill in. So if I_14_12, I_15_12, and I_16_12 are not the right ones, please substitute the right ones in the code above. But, anyway, once You've added that code on to your custom.js file, save your changes, and click the "refresh" button on your Genie Design Toolbar so that Genie re-loads the custom.js file and so that the function is available.

Then, on your text box widget -- you already have the "choices database file", "choices options" and "choices values" set properly. But, change the "onselect" event to just be the name of your function in the custom.js. (Do not add parenthesis to the name or a semicolon... just the name by itself).
2-18-2015 11-52-31 PM.png
2-18-2015 11-52-31 PM.png (8.16 KiB) Viewed 1747 times
Save your changes and try it out -- it should now work.

Alex also mentions a 'results template' so you can control how the addresses are formatted... This is just if you want the auto-complete results to look different... it should work fine without that. But, if you do want to control what the results look like, you could use this 'results template'.

The only problem is that the 'results template' is a brand new feature that we've added on our development box and it has not yet appeared in a release of Profound UI. So, if you want/need this feature, we'll need to create a patch that we can use to add this functionality to your existing installation. If you need that, please e-mail us at support@profoundlogic.com and let us know what version of Profound UI you are using, and we'll make a patch for you.
FoxBill
Profound User
Posts: 38
Joined: Mon Jun 20, 2011 11:44 am
First Name: Bill
Last Name: Streit
Company Name: Fox Metro WRD
Contact:

Re: Setting lower limit of subfile display

Post by FoxBill »

Thanks Scott

That worked fine and was exactly what I was trying to do.

Bill
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest