Using the Condition Step in DMXzone Sever Connect

Using the Condition Step in DMXzone Sever Connect

Learn how to setup a condition using Server Connect

With this movie we will show you how to use the condition step integrated in DMXzone Server Connect.

Step by Step

We will show you how to use the condition step integrated in DMXzone Server Connect. The example that we're going to show you is a form which submits info about car parts, into the database. Before inserting, we'd like to check if the entered part number exists in our database. If it exists we will only update the price. If it does not exist we will insert it as a new record. First, let's create a server action file. And add a name for it (1). Then click globals (2). Browse to the page containing your form and select it (3). Then select your form from the drop down and click the import from form button (4).

Right click steps when you are done importing the form fields (1). And add a database connection (2).

Setup the database connection (1). And click ok when you are done (2).

Then right click the database connection step (1). And add a database query (2).

add a name for it (1). And then click the query options button (2). Select your database table and add it to the query (3).

then add your database table columns to the selected columns list (1). Open the filters tab (2). We need to check if the entered part number already exists in the database. So we select the part number column as a filter (3).

And add it. Then let's select the form field where we enter the part number as a filter value.

We select the part number form field under the global post variables. click the select button. And then click ok.

Now we have our database query filtered by the entered part number. Now we need to add a condition which checks if the query returns a record. Right click the database query step. And under core actions add condition (1). Select the condition value (2). Here we select the database query which we already created. And then we click the select button (3).

When the condition is met all of the steps which we add under then will be executed. Otherwise the steps under else will be executed. Our condition will be met if the query returns a record in this case we need to update the existing record info. So right click steps under then. And add database update (1). Setup update options (2). Select the database table and add it (3). then add the columns that need to be updated. In our example it is the price column (4). Select its value (5).

We get the price value, from the price form field, under global post variables(1). Click the select button (2).

And switch to the filters tab. Here, we filter by the same column, as in the database query, that we created (1). This is the part number column (2). Select its value (3).

This is the part number form field under the global post variables (1). Click select (2).

And click ok. Now if the entered part number exists in the database its price will be updated. Right click steps under else. And add database insert (1). Open the insert options (2). Select your database table and add it (3). Then add the columns which you need to insert data into (4). We select the part number column. And then we click the dynamic data button for its value (5).

The part number value should come from the part number form field under the global post variables. Click select.

And do the same for the rest of the database table columns selecting the corresponding form fields as values. Click the ok button, when you are done.

And save you action file (1). Now, let's create an executor for our action file (2). Click the add new button (3). Add a name for the executor. Select your action file from the drop down. And bind this executor to your form. Then set the method to post. And click the OK button (4).

Now, when the entered part number, exists into the database its price will be updated otherwise a new record will be inserted. That's how easy it is to use the condition step integrated in dmxzone server connect.

Extensions Covered

Comments

Be the first to write a comment

You must me logged in to write a comment.