Page 2 of 3
Re: SQL in Profound
Posted: Mon Nov 04, 2013 7:50 am
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?
Re: SQL in Profound
Posted: Mon Nov 04, 2013 10:01 am
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.
Re: SQL in Profound
Posted: Wed Nov 06, 2013 5:13 am
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?
Re: SQL in Profound
Posted: Wed Nov 06, 2013 9:59 am
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?
Re: SQL in Profound
Posted: Tue Sep 09, 2014 2:49 pm
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.
Re: SQL in Profound
Posted: Tue Sep 09, 2014 5:00 pm
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 (13.88 KiB) Viewed 643 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.
Re: SQL in Profound
Posted: Tue Sep 09, 2014 5:09 pm
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.
Re: SQL in Profound
Posted: Tue Sep 09, 2014 5:24 pm
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 (8.37 KiB) Viewed 643 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.
Re: SQL in Profound
Posted: Wed Sep 10, 2014 7:28 am
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.
Re: SQL in Profound
Posted: Wed Sep 10, 2014 8:53 am
by Scott Klement
You're missing the "script:" in your choices parameter value.