Advanced recipes give you the option to combine recipes together with scripting and components such as smart input component, in that way you can do step-by-step filtering to make it more user friendly.
Using recipes together with smart input field:
First, we need to create a recipe as shown in the recipe section.
Then we fill recipe with some data.
Now we will create a view and set active recipe on this view
We want to filter by name.
We add smart-input component into our view
As a type we can either select combo-box string or list-box string
Now as a tag we will click on “…” go into equations and then click on “variables”
We will select activeRecipeFilter1 (1 because the name is the first item which we have checked in active recipe selection on the view), press okay.
Now we need to set “dynamic items” scroll down a bit, now because we want to filter out the name we put a variable activeRecipeFilteredData[‘name’] inside.
Now we can insert component.
To make it more automatic without need of user action we can also create a function in view script which will open up the active area with the filter which user select.
So we will create a active area inside view without any init and then head to view script.
We will create a function
function openRecipeFilter(){
var options1={};
options1[‘type’]=”recipe”;
options1[‘screen’]=”activeRecipeShow”;
options1[‘target’]=1;
options1[‘textScale’]=100;
options1[‘rowFilter’]=true;
options1[‘disableFilterRow’]=false;
myscada.openCommand(options1);
}
Which will open up “Active recipe” in Active area when called.
Now head back to the view, on the smart-input component there is a option to use “callback function” which will call a function from view script when the selection of filter is done.
So when the user select his recipe filter it will open up active area with selected filter and recipes which fits the filtered text or value.
Now if we download a project it will look like this:
As you can see inside listbox we display all the available recipe names now if we select one of them it will open up active area with filtered recipe.
Now as you can see once we have selected item we can’t just go back and select the other recipe (Like if we miss-clicked or something).
There is a feature on smart input which solves this.
Simply just check “Add not selected item”.
And download the project once again.
Now we can select again but as you can see we have a “—” which gives us option to reset filter.