Simplicty and flexibility!

How to send parametes in a chain of redirected pages (simulate the DOS chain menu in DG3)

Started by DataEase Development
You will need to Sign In to be able to comment on the Blog!

How to send parametes in a chain of redirected pages (simulate the DOS chain menu in DG3)

User that have been using DataEase for a while know that a common problem is that you lock your self out of a table if you try to do things that need a full table lock (delete all) in the same dql that you do updates. To overcome this, we used to use chain menus in the good old DOS days. That is a sequence of events that hands the control from on DQL to the next and sends some global parameters on the way. You can do much of the same, using pages that redirects to new pages in DG3.

First you need the new a few basics about web and how it works:

  1. All web pages are stateless (that is one page do not know anything about any other page).
  2. Each request must be served all the information they needs for each for each page request.
  3. A redirect basically means leave this page and load a new page (the new page knows nothing about the state of the previous page).

The solution to that problem is to make sure the parameter sent to the first page are forwarded to the next. For instance if you send a field1 (data entry) as a parameter to the first page but need to use it in a DQL later in then chain, you send the ?field1=value1&field2=value2 from the first to the next and so on.

There are several ways to read and resend parameters form one page to the next as using livetext or session variables. The simplest one is to use livetext in the redirect. All parameters from the urls can be found in xdg3.url.paramname (DG3 0.13.1019 or newer) and gdict.paramname in all versions.
That means that your redirects must look like this to forward the url query parameters given to the first page to the next:
/URLToNextPage/?field1=[{ xdg3.url.field1 }]&field2=[{ xdg3.url.field2 }]

Repeat this on each page in the chain and every page will get the correct values. Mind: any livetext variables loaded by each page can be used in the redirect, not just the previous query paramters.

Written by DataEase Development 30/07/13 at 13:22:44 DataEase Generation 3