Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleRequired apps
  • Power Custom Fields PRO™ or
  • Power Custom Fields

...

Button handy
blanktrue
color#0052CC
nameSend Feedback
linkhttps://docs.google.com/forms/d/e/1FAIpQLScmToBe3vynAlb5fdKwCGxYqnTbDc66sIBgeecG2BuFDuHc7g/viewform?entry.2002826954=Example+1+-+Working+with+large+data+sets+-+15481685
widthauto

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 Removed

Considering image-20240214-161133.pngImage Added

For 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
  • The maximum results number set to 50 and the filtering strategy set to "

DataSource
  • 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 Removed

image-20240214-163329.pngImage Added

We 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 Removed

See also

  • PCF - Multi Select
  • SIL™ Data SourceImage Added

    See More

    Child pages (Children Display)
    pageExamples for PCF