Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Huge data sets
...
Button handy | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
For this example, you have a business selling car parts and of course you . You have thousands of products and have to work with huge large data sets. Power Custom Fields™ Fields helps save you save your time tremendously because you by no longer need requiring you to go through the list of all products to select the necessary one.
The app enables lets you to intervene in the process of data build-up even in process, including the autocomplete stages of the autocomplete. You can see this in the picture belowfollowing image:
Image RemovedConsidering Image AddedFor this example, we have a PCF - Multi SelectSingle Autocomplete custom field configured with one SIL™ Data Source, one Selection script, minimum in the follow ways:
One SIL Data Source
One script file
Minimum characters for autocomplete is set to 5
The maximum results number set to 50 and the filtering strategy set to "
DATASOURCE."
We want to select from our big data set the items using the ids they have.
For this example we We used the following SIL data source.
Code Block |
---|
string s = argv["query"]; KPOption [] res; if(length(s) > 2) { KPOption[] options = sql("myDB", "select name, id from car_parts where id like '%" + s + "%' limit 100" ); for (int r = 0; r < size(options); r++) { if (contains(options[r].value, s)) { res = addElementIfNotExist(res, options[r]); } } } return res; |
In the script above,:
myDB represents the resource name of the data base used,.
car_parts represent the table from the data base we want to select from.
("name", "id") are the columns converted to an object of the KPOption type and represented by a pair (label, value).
If you use this script as data source, your custom field will be populated like this:
Image RemovedImage AddedWe can use a select script to do certain specific things when an item from the autocompleted list is selected. :
Code Block |
---|
KPOption[] selectedOptions = customfield_12101; description += "You have selected the next item: " + selectedOptions[size(selectedOptions)-1].label + "; " + selectedOptions[size(selectedOptions)-1].value + "\n "; |
The example above sets the description like this:
Image RemovedImage AddedSee More
Child pages (Children Display) | ||
---|---|---|
|