Drop down choice is not being maintained

Use this board to ask questions or have discussions with other Rich Displays users.
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Drop down choice is not being maintained

Post by Stuart »

A brief scenario of the issue: dropdown selection is made. When screen is rewritten, the choice (display) goes back to blank.

I am using "database driven selection" values in Profound to populate the drop down.

The "choice values field" is a compound value, not a simple field name. I am concatenating fields together, separated by a comma, to return a comma separated variable string, to the bound "values" field. The "choice values field" looks like this:
'DIGITS(C.VNDPPOID)||','||DIGITS(C.VNDFEIN)||','||DIGITS(C.VNDMOD)||','||C.VNDPTYP

This returns to the values field the desired outcome, e.g "000000001,987654321,001,4"

The "choice options" field is a simple name of a field in the database file

However, when the screen is redisplayed, the dropdown selection is blank.

I was thinking that the "values" field 00000001,987654321,001,4 is compared against the what is returned from choice values field DIGITS(C.VNDPPOID)||','||DIGITS(C.VNDFEIN)||','||DIGITS(C.VNDMOD)||','||C.VNDPTYP, when the SQL is run, to display the correct value (in my case, a description field) for the selected dropdown value.
The concatenated value is a unique value in the table
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Drop down choice is not being maintained

Post by David »

You are correct -- when the screen is displayed, the contents of the field bound to 'value' is used to determine what option in the drop down is pre-selected. If this matches to one of the records in the drop down box, that item will be selected.

So, when the screen is displayed, the contents of the 'value' field must not match exactly to any of the 'choice values' in the drop down. If the bound 'value' field is defined as character, it could be that the number is not right aligned, or doesn't have all the leading zeros, etc., that sort of thing. It has to match EXACTLY to what is returned by SQL that expression in the 'choice value' field.

Does this help?
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Re: Drop down choice is not being maintained

Post by Stuart »

Yes David, you affirmed of how I thought the selection worked. I will review closely what I am returning to rule out any data truncation/mismatch errors.

I'll post again after I have reviewed the SQL
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Re: Drop down choice is not being maintained

Post by Stuart »

Here is (how I think ProfoundUI) is building the SQL:

SELECT c.vndnam
FROM VNDCONPM A,VNDSTEPM B,VNDAUXPM C
WHERE A.VNDPPOID = B.VNDPPOID And
A.VNDFEIN = B.VNDFEIN And
A.VNDMOD = B.VNDMOD And
A.VNDPTYP = B.VNDPTYP And
A.VNDPPOID = C.VNDPPOID And
A.VNDFEIN = C.VNDFEIN And
A.VNDMOD = C.VNDMOD And
A.VNDPTYP = C.VNDPTYP And
A.VNDCON = 'THERAPY' And
B.VNDSTE = 'LA'
And
DIGITS(C.VNDPPOID)||';'||
digits(C.vndfein)||';'||
digits(C.vndmod)||';'||
c.vndptyp
=
'000007405;000000000;000; '

Color legend below:

choice options field
choices database file
choices selection criteria
choice values field
value

All of the above are bound fields, with the exception of choice options field

When I execute the above sq, I receive one record, the C.VNDNAM field contains "NSG"

What am I missing/doing wrong?
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Re: Drop down choice is not being maintained

Post by Stuart »

Am pondering using a "statically defined" list by using the "Selection choices" instead, and creating comma seperated lists for the choices and values, but it seems like the database selection should work.
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: Drop down choice is not being maintained

Post by Scott Klement »

You can see exactly which SQL statement is being run by looking at the PUISSNVP physical file when the screen is active. The file is keyed by your session number (a 64A randomly generated hex string) followed by the widget id. Out in column 167 or so, you should find the SQL statement itself.

I must admit, I haven't seen a dropdown with such a complex SQL statement as the one you posted. Drop downs typically read only one file, they don't join multiple files together as your example has done...
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: Drop down choice is not being maintained

Post by Scott Klement »

The code inside Profound UI that generates the SQL statement for a dropdown looks like this:

Code: Select all

          var sql = "SELECT DISTINCT " + fieldList + " FROM " + file;
          if (whereClause && whereClause != "") {
            sql += " WHERE " + whereClause;
          }
          if (orderByFields[0] != "") {
            sql += " ORDER BY " + orderByFields.join();
          }
(This is JavaScript code, but it's simple enough to understand, I think.) You can read the select box code in it's entirety, here:
https://github.com/ProfoundLogic/profou ... ect_box.js
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Re: Drop down choice is not being maintained

Post by Stuart »

The drop down list is being initialized/populated perfectly... The issue is that when a value has been selected, and the screen is rewritten, the descrition (choice field) being displayed is not matching to what is in the "values" field; The dropdown is showing a blank selection. The "values" field has a value that identifies the entry selected, I believe, and is used in displaying the correct "choice" in the dropdown... This is not happening. The dropdown selection being rendered is balnk when the screen is displayed... So how does ProfoundUI "match" the bound values field to what should be displayed in the dropdown selection?

In my prior post, I added the "values" field to the SQL that I had written to confirm that the value would match to the description that the dropdown should display.
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Drop down choice is not being maintained

Post by David »

I'd suggest looking at it this way...

As Scott indicated, the PUISSNVP file will have the exact SQL statement that is used to build the drop down box. I'd suggest running that, and see what comes out for the 'choice value' field. The statement is a bit different than what you had posted -- the expression that you're using for 'choice value field' goes into the list of fields to select.

Go ahead and run the statement to see exactly what comes out for that. Then, try debugging the program when it re-displays the screen and see exactly what value the program has in the bound 'value' field. An alternative to debugging is to add a new output field on screen and bind the same field you're using for the 'value' of the drop down box so that you can see it display on screen.

Somehow, the 2 values don't match up. If they did match exactly, then the proper option would be selected in the drop down box.
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Re: Drop down choice is not being maintained

Post by Stuart »

I have the profound ui application in STRDBG mode, with a breakpoint on the EXFMT statement, and then another breakpoint just after the EXFMT statement. As I step through the debug process, I am running interactive SQL (STRSQL from the command line) to query the PUISSNVP file. The file is empty. What am I doing wrong?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest