Searchable Tables in Opto 22 groov View

Building directly on the work we did in the previous post integrating database tables with Opto22’s groov View Platform using Node-RED, we will now add a search function to our database. We’ll keep it simple in this example, and just allow the user to search for a recipe by name. But, we could easily extend the search function to look for any of our recipe parameters.

Set Up MMP Tags

As is tradition in groov View when integrating with Node-RED, we’ll first set up an MMP tag we can use to trigger our flow. In this case we will use a String tag. First, go into groov Manage on our groov RIO, and look at the MMP area to find an address. In this example we will use 0XF0D82000.

MMP tag configuration in groov Manage for our search term tag.

Next, we will go into groov View’s Build Mode -> Configure Tags, then add this tag to our MMP I/O Device.

Updated tag list in groov View including the new search tag.

Modify the groov View Page

Next, we will go into our page and add a Text Box to allow the user to search for a value. We will then map it to the tag we added above and change the label as needed.

Text box component on a groov View screen.
Tag binding in groov View for a text box component.

We will also make a small quality of life improvement for our operators: if our query returns fewer values from the database than rows in the table, we can hide the components using the Visibility property. We will apply this to all of the items in the table. Since we know we will write a value of 0 to the temperature in Node-RED for any invalid or empty recipes, we can use this tag directly. Each row will use the relevant Array element of the table data store tag.

Selecting a value gadget in groov View.
groov View configuration to hide components with a zero value for their temperature in the recipe.

Modify the Node-RED Flow

Now that we have the screen set up and mapped to the MMP Tag, we will go through and modify our Node-RED flow to handle this new use case.

Our overall NodeRED flow for communicating with our groov EPIC controller and the database.

First we will add another I/O node to read in our search value from groov View. We will configure it to look at the SearchName tag from above, and we will tie it into a set node to set the flow.search value, and also trigger the IO for pagination as shown above.

Address configuration for our search term tag in a groov I/O node in NodeRED.

We will then open the function node leading into the Opto22 connection and modify our query to add in a where clause if the value of flow.search is populated. This will modify the results we return from the database and populate everything using the rest of our existing flow. We can then deploy the flow.

Updated SQL query to use our search term to filter the recipes returned from the database.

Test It Out!

Pulling everything together you can see we first pull in all of the recipes from the database, and then we search for “Recipe 2” and we are then shown only the recipes that have Recipe 2 in the name, in this case Recipe 2A and Recipe 2B. To clear the search and show all recipes we clear out the search box and will see all the recipes again.

groov View Recipe management screen with no search term so all recipes are shown.
groov View search screen searching for "Recipe 2" so only recipes with that text in the name are shown.

Wrapping Up

We now have a fully functional search feature for our recipes in groov View!

The final step in the process is to tie our recipes into our PLC code so we can use them to control our process. This will require some additional development in groov View to load a recipe into the PLC, and some PLC programming to use the data from our recipes in our process control system.

Updated - 9/9/2022

Previous
Previous

Ignition Perspective vs. Vision Mobile Module: Best Practices for Moving Forward

Next
Next

Managing User Sessions in Ignition Perspective