In this example, we will see how to pass PHP parameters from one application to a widget from a dashboard to another application in another widget. In the dashboard, we will create a widget with an application that shows a grid with orders and another widget with the details of the order selected in the first widget.
1. Creation of the application for order details.
1.1- Create a new Grid based on the application of the order_details table, but let’s change the Select command to add a WHERE clause with a variable (where [ord]).
1.2- Go to the Events >> onScriptInit item in the application menu to assign values to the variable used in the application’s SQL command.
onScriptInit
if(empty([ord])){
sc_select_where(add) = "where orderid > 1 = 1";}
else{
sc_select_where(add) = "where orderid = [ord]";}
sc_reset_global([ord]);
3. Generate the source code of the application.
2. Creating the Order application
2.1- Create a new Grid application based on the “orders” table.
2.2- Access the item “Fields >> New field” in the application menu.
2.3- Create a text field of type called “details“.
2.4- Go to the “Events >> onRecord” item in the application menu
2.5- Copy and paste the following code
onRecord
{details} = "<img src='../_lib/img/grp__NM__ico__NM__cross.png' border = '0' Title='Details'/></a>";
2.6- Access the item “Application Links“.
2.7– Create a “Field Link” in the “details” field.
2.8 – Select the Detail Grid created earlier, and the parameter passed will be the “orderid” field.
2.9 – Generate the source code of the application.
Creating a new Dashboard
3.1 – Now let’s create the Dashboard.
3.2 – In the application menu, go to Settings >> Add connection widget.
3.3 – Click on the pencil icon to edit and select the applications that will be displayed in the widgets.
3.4 – The first widget, we will display the Order Inquiry, and we will select that the details field link in it will be opened in the other widget.
3.5 – The second widget, we will display the Order Details Inquiry.
4. Click the Run button on the toolbar.
Comment this post