SQL in Profound

Use this board to ask questions or have discussions with other Rich Displays users.
paparazia
Profound User
Posts: 25
Joined: Mon Sep 23, 2013 7:08 am
First Name: ALIMA
Last Name: SECK
Company Name: OO2
Contact:

Re: SQL in Profound

Post by paparazia »

Hello scott,
at fisrt i had an error with the onchange because in the get() and ApplyPrperty(), i put the names of tables and not the id field.
Now i haven't error but the second dropdown is not refreshed when i choose in the fisrt dropdown.

i think the problem is the parameters in the get() and applyProperty()

Also i have a question: it is necesary to use get() in the second dropdown or one of both can be used for doing it?
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: SQL in Profound

Post by Scott Klement »

It should only be necessary to call get() in the applyProperty() call.

To refresh the widget, you need to apply the 'field type' property, as shown in the examples in this thread.
paparazia
Profound User
Posts: 25
Joined: Mon Sep 23, 2013 7:08 am
First Name: ALIMA
Last Name: SECK
Company Name: OO2
Contact:

Re: SQL in Profound

Post by paparazia »

By the way Scott, I have no error message but the second drop-down list is not refreshed.
Also I would like to know if we can use get () and ApplyPrpoerty simultaneously or should only use one of them.
Here's how I implemented my JS:

in the onchange property:
applyProperty("LOID", "choices parameter value", get("PYID"));
applyProperty("LOID", "field type", "select box");


Why the second is not refreshed?
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: SQL in Profound

Post by Scott Klement »

Those look correct to me.

Please make sure that 'LOID' and 'PYID' are the correct ids. Remember that IDs are case-sensitive, so you have to make them match exactly.

Does that help?
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

Re: SQL in Profound

Post by ppbedz »

I just tried your example with the "applyproperty" code and it works great. However, I need a little twist. Still using "company" and "division" as examples, I would like ALL "divisions" to be loaded into the "division" drop down if a "company" is not selected. If a "company" is selected, I only want to load the "divisions" for the selected "company". Can you help? Thank you.
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: SQL in Profound

Post by Scott Klement »

Patti,

In order to have the 'division' box show all possible divisions until a company is selected, I was thinking you could change your properties to look like this:
seldivision.png
seldivision.png (13.88 KiB) Viewed 647 times
and then change the 'onchange' event for the company drop-down to set both parameter markers like this:

Code: Select all

applyProperty("selDivision", "choices parameter value", get("selCompany"));
applyProperty("selDivision", "choices parameter value 2", get("selCompany"));
applyProperty("selDivision", "field type", "select box");
Unfortunately, what I discovered was that the applyProperty() routine will not work with "choices parameter value 2" -- it seems that there's a bug here that prevents applyProperty() from working with any property that ends in "2" or "3", or any other number.

I will fix the applyProperty() API for the next release of Profound UI so that it handles these correctly.
SeanTyree
Profound User
Posts: 76
Joined: Fri Jan 11, 2013 6:11 pm
First Name: Sean
Last Name: Tyree
Company Name: US HealthWorks
State / Province: California
Zip / Postal Code: 91355
Country: United States
Contact:

Re: SQL in Profound

Post by SeanTyree »

Scott,
Couldn't you change the choices selection criteria to:
DIVCO in (?, '')

Thus avoiding the issue with choices parameter value 2?

Sean

edit- sorry that won't work, I misunderstood the desired functionality.
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: SQL in Profound

Post by Scott Klement »

Sean,

That's a great idea... I was trying to think of something like that, and for some reason, I just couldn't.

However, your code is wrong. Your code would be correct if she was trying to select all records where the divco field is either blank or is set to the company number. But, that's not what she's trying to do ... none of the divco fields in the database are blank. (Indeed, it's a numeric field, they can't be blank.) What she wants is to include all records (no matter what divco is set to) when the company number is blank.

So, taking your idea and changing it around a little bit, she could set the division box up like this:
seldivision2.png
seldivision2.png (8.37 KiB) Viewed 647 times
So it's not when DIVCO is either blank or the company number... but rather, when the company number is blank, or when it matches DIVCO. Hope that makes sense. And of course, we have to convert divco to character since the company number can be a blank.

Then, of course, the onchange for the company box can look like this:

Code: Select all

applyProperty("selDivision", "choices parameter value", get("selCompany"));
applyProperty("selDivision", "field type", "select box");
And that way, it'll work with just one parameter marker, so doesn't requite any updates to the applyProperty() API. (Though, I will still fix it for the next release.)

Thanks for the idea, Sean.
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

Re: SQL in Profound

Post by ppbedz »

Sean/Scott,

This isn't working quite right. I need all of the divisions to be available as a choice if the company is blank. I made the modification suggested and it only shows the value for "blank option" in the drop-down. Note: In my problem, company = jobcode, and division = skillset. I want them to be able to do either of the following: select a job code and have the associated skillsets appear in the drop-down, OR do not select a company and have all skillsets listed in the drop-down. Enclosed are some screen shots (I don't know how to insert into body of the post?) Thank you for your help.
Attachments
skillset.PNG
skillset.PNG (17.93 KiB) Viewed 645 times
jobcode.PNG
jobcode.PNG (15.4 KiB) Viewed 645 times
screen.png
screen.png (12.67 KiB) Viewed 645 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: SQL in Profound

Post by Scott Klement »

You're missing the "script:" in your choices parameter value.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest