
Within the table “Parameter” we have the percentage of interest that the user will pay based on the number of months that he chooses in our application. The process that we will do will calculate the percentage of interest that the user will have to pay based on the amount desired and the number of installments (months) that he needs to pay back. The table “Parameter” in a PostgreSQL database. In terms of Database structure, we have two tables which are shown below:

We will use the following Scriptcase Macros to make our work easier:

On the other hand the user will enter some parameters and then complete the calculation and insert the result into the Database. The data processing that we will show as an example here is the one done at the Application level, to execute this example we will take certain parameters from the Database. Depending on how big the volume of data to handle are and the interaction that the user must have, one or the other may stand as the best option in some cases. To change the records of the second table (Client), put the following code on the onBeforUpdate Event.Data Processing in Control Forms: Using Macros to query and insert into Databaseĭata processing can be done at the Database level (with Stored Procedures, Triggers, Functions and so on) or Application level. We change the client field of the formulary to select type and we create a OnChange Event on that field calling the method ‘carregarCliente’, including the following line:Ĭhanging records of both tables at same time In the onLoad event call our ‘carregarCliente’ method by entering the following command line: In the first bracket inform the row of the matrix, on the second we inform the column. This dataset is a PHP matrix where we have two positions in brackets. The second parameter we reported a String with the sql SELECT statement to retrieve the values. you can give any name for this dataset, in this example we will name it customer. This macro have 2 parameters, the first is a dataset that retrieve the values. Here we are using the macros sc_lookup () with this macro can retrieve database records running a SELECT on any table in the database.


Will create a PHP method called showCustomer, include the code below:Ĭompanyname, ContactName, stateid, city, address, CreditLimit In this application we have to create fields to show the values of the customer from the Customers table. we will show customers data in the form application of order.įirst we will create a form based application in the first table, orders table. We will use tables that represent orders and customers, where each order has its customers. In this tutorial we will show how to show and manipulate data of two different tables in the same application with macros. Showing fields of two tables in the same application.
