Actions
In order to perform certain actions from the backend progress, actions can be used
Action | Description |
---|---|
s-refresh | Refresh the screen |
s-new | Change the mode of the screen to new mode |
s-update | Change the mode of the screen to update mode |
s-exit | Close the current screen |
s-last | Reposition to the last record in the screen |
s-next | Reposition to the next record in the screen |
s-prev | Reposition to the previous record in the screen |
s-first | Reposition to the first record in the screen |
s-cancel | Cancels the current transaction |
prevtab | Moves to the previous tab of the current screen |
runxeprog | Run the program from the backendUsage: p-action = ‘runxeprog’ + char(2)+ ‘ProgramToRun’ |
Opendownloadfile | Download the file on the server to html clientUsage: p-action = ‘opendownloadfile’ + char(2)+ ‘FileLocation’ |
‘s-refresh’ used as:
procedure v-newChoose:
/*------------------------------------
Field: v-new
Event : CHOOSE
--------------------------------------*/
/* send action to refresh the screen */
p-action = ‘s-refresh’.
end procedure. /* v-newChoose */
‘runXEprog’ used as:
procedure v-newChoose:
/*-------------------------
Field: v-new
Event : CHOOSE
------------------------*/
/* opens user maintenance program(x/xusem.p) which is already in our repository. Should be always separated by chr(2) */
p-action = 'runxeprog' + chr(2) + 'x/xusem.p'.
end procedure. /* v-newChoose */
p-result
Used to set the widget value on the screen
‘p-result’ used as:
procedure v-newChoose:
/*----------------------------
Field: v-new
Event : CHOOSE
-------------------------------*/
/* assign 500 to v-ammount widget in screen*/
p-result = ‘v-ammount' + chr(1) + ‘500’.
end procedure. /* v-newChoose */
(For multiple widgets)
p-result = “widget_name” + chr(1) + “value” + chr(1) + “widget_name1” + chr(1) + “value”.
p-attribute
Used to set attribute to a widget on screen.
Used as:
procedure p-beforeDisplay:
/*-------------------------------------
Event : BEFORE-DISPLAY
-----------------------------------*/
/* assign values to days combo box and show Tuesday as default value whenever screen opens */
p-attribute = 'v-days' + chr(1) + 'list-item-pairs' + chr(1)
+ 'Sunday,1,Monday,2,Tuesday,3,Wednesday,4,Thursday,5,Friday,6,Saturday,7'
+ chr(1) + 'v-days' + chr(1) + 'screen-value' + chr(1) + '3'.
end procedure. /* p-beforeDisplay */
(for multiple widgets)
p-attribute = “widget_name” + chr(1) + “attribute” + chr(1) + “value” + chr(1) + “widget_name1” + chr(1) + “attribute1” + chr(1) + “value1”
p-dataset
p-dataset will hold the dataset as a longchar variable. It is used in program where dataset is used in the query. Once the dataset is assigned some value, the dataset is passed back to the client.
This variable is meant to be used in ds-fill event. Make sure you include x/xxxxlparamds.i while using it.
x/xxxxlparamds.i}
def temp-table tt-xuser serialize-name 'xuserremote' like xuser.
def temp-table tt-xugroup serialize-name 'gpremote' like xugroup.
def dataset ds-xuser serialize-name 'dsetusers’ for tt-xuser, tt-xugroup
data-relation dr1 for tt-xuser, tt-xugroup relation-fields(xusec,xusec) nested.
procedure p-fillds :
for each xuser no-lock:
create tt-xuser.
buffer-copy xuser to tt-xuser.
release tt-xuser.
for each xugroup where xugroup.xusec = xuser.xusec no-lock:
create tt-xugroup.
buffer-copy xugroup to tt-xugroup.
release tt-xugroup.
end.
end.
dataset ds-xuser:write-json ('longchar', p-dataset).
end procedure.
p-error
Purpose:
Used for displaying Multilanguage error message on the client. The error message needs to be defined in “X/E Files -> X/E Master Files -> Messages”.
Used as:
procedure p-afterEnable:
/*-----------------------------------
Event : AFTER-ENABLE --------------------------------*/
/* Shows the error message with Errorcode errorMsg stored in messages maintenance program*/
p-error = 'errorMsg'.
end procedure. /* p-afterEnable */
When the error message itself has replaceable variable
p-error = “errormessage” + chr(1) + “value that substitute #1” +chr(1) + “value that substitute #2”
procedure p-afterEnable:
/*---------------------------------
Event : AFTER-ENABLE
--------------------------------*/
/* Shows the error message with Errorcode errorMsg stored in messages maintenance program and having replaceable values [#1] and [#2] in it . This [#1] and [#2] will be replaced by chr(1) separated values */
p-error = 'errorMsg' + chr(1) + "123" + chr(1) + "321".
end procedure. /* p-afterEnable */
p-mode
Purpose:
Used to get the mode of the current screen
This variable will return an integer value which represents the mode of the current screen.
Mode | Description |
---|---|
0 | Display Mode |
1 | New Mode |
2 | Copy Mode |
3 | Update Mode |
Used as:
procedure p-afterEnable:
/*--------------------------------
Event : AFTER-ENABLE
---------------------------------*/
/* display current screen mode */
message "screen mode = " p-mode view-as alert-box.
end procedure. /* p-afterEnable */
p-rowid
Purpose:
p-rowid returns the rowid of the main table of the program. The datatype of the returned value is also ROWID. This variable can only be used in maintenance program with database tables as main query.
Used as:
procedure p-afterEnable:
/*------------------------------------
Event : AFTER-ENABLE
------------------------------------*/
/* using p-rowid to find current customer and show customer number in alert box if available */
find first customer where rowid(customer) = p-rowid no-lock no-error.
if available customer then
message customer.cust-num view-as alert-box.
end procedure. /* p-afterEnable */
p-value
Purpose:
p-value returns the screen value of the current widget. This variable can be used as an alternative to f-getvalue. However, it can only retrieve value from the current widget.
Used as:
procedure p-valueChanged:
/*-------------------------------------
Field: v-days
Event : VALUE-CHANGED
-----------------------------------------*/
/* displaying screen value of days combobox using p-value and f-getvalue */
message program-name(1) skip p-value skip f-getvalue('v-days‘) view-as alert-box.
end procedure. /* p-valueChanged */