Macros on Scriptcase is the same as in any other programs, it is a saved sequence of commands or keyboard strokes that can be stored and then recalled with a single command, it is the same as a function from PHP. Scriptcase has more then 150 created macros to help you to insert your own business rules.

You can check the full list of macros at this link

Redirecting from a form to a grid

In this example we will use both macros to redirect from a form application (using the ‘order’ table) to a grid application (using the ‘order_detail’ table), we will use the sc_redir macro to call the grid application passing the primary key as parameter to filter the grid application, and we will the sc_apl_conf macro to change the grid application to set it to show an specific number of lines per page.

The sc_redir macro is commonly used when there is a need to make a redirection from one application to another.

The macro sc_apl_conf is used when we need to change an application proprieties, for example, open a form in addition mode or change the number of row from a grid dynamically.

Initially we will have a button to redirect the form to the grid, with the parameter passing the orderid field.

 

Now the redirection button is done, we have to configure the receipt of the redirect parameter on the grid, on the “SQL” option on Scriptcase, and we will do a where and declare the variable with the redir made on the form, which was transformed into a global variable.

Now we will use the macro sc_apl_conf to provide only 1 record per page on the grid, if it have 2 or more records.

On the form, we will select a record, verify the primary key, and hit the button to redirect the detail that we did.

And on the detail, we have only the records that have the same key, and we used the macro sc_apl_conf to configure the application to show only one record, will be this:

Another example of using the macros sc_redir and sc_apl_conf

Both macro sc_redir and sc_apl_conf, have other features besides those that we’ve mentioned before. We can use the macro sc_redir redirect from an application to a website too. For example:

And we can use the macro sc_apl_conf to start a application form already in insert mode (new), using it on the OnApplicationInit event.

 

Learn more about this and other features that Scripcase offers. Do you already know Scriptcase? Download the free version of our tool and discover a world of new possibilities.

Visit our blog and see more posts!

By , I have a degree in Computer Science and a Diploma in Business Management and Marketing, Founder of Avanza Consultora (Partner of Netmake Scriptcase in Paraguay). Senior Programmer with more than 11 years of experience in Development, the last 5 years developing with Scriptcase.

October 9, 2017

a

You might also like…

AI-Driven Software Development: The Role of ChatGPT

In the rapidly evolving world of technology, artificial intelligence (AI) is playing an increasingl...

Low-Code: The Key to Accessible Digital Transformation

Digital transformation is imperative for companies wishing to remain competitive in the current era...

Web Development and IT Trends for 2024: Towards New Technological Horizons

The world of Information Technology (IT) and Web Development is constantly evolving, and the year 2...

You might also like…

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.