There are a variety of reasons to pass values between entities. It is PREFERABLE that you pass values using this method as opposed to entering global variables. Global variables should be avoided when possible.
Hyperlinks and Xephr functions should always use single quotes ( ' ) instead of double quotes ( " ).
Passing Values between Entities
Passing Values between Entities, remaining within the same window
When creating this link, the Hyperlink To field will contain the function call, and the Hyperlink Scripted pop-list needs to be set to true.
Enter the Xephr function call to set the parameters that you are passing.
SetParameters
Add an open parenthesis (
Enter the block and field to which the values will be passed in quotes, followed by a comma. 'BLOCK.FIELD',
The block entered is the block to which the value will be carried. For example, in the case of a list block, enter the detail block that is assigned to a database table/view and not the header block which is not assigned to a database table/view and has just has the labels.
Enter the code to obtain the field value to set this parameter, followed by a comma $$BLOCK.FIELD$$, or $$BLOCK.FIELD.first$$,
If you wish to set a temporary global on the entity that you are opening, enter the name of the global in quotes preceded by an asterisk, followed by a comma '*GLOBAL', If you wish to set a session global when the entity is opened, use 2 asterisks '**GLOBAL',
To define the value for the global, enter the code to obtain the field value that will be passed from the current entity, followed by a comma $$BLOCK.FIELD$$, or $$BLOCK.FIELD.first$$;
Repeat 4 thorough 7 for any additional values that you are passing. The final value will NOT be followed by a comma.
When all values have been entered, add a close parenthesis )
Always close with a semi-colon ;
Enter the Xephr function call to define that the entity to be opened will be opened in a new window.
ShowInWindow
Add an open parenthesis (
Enter the entity that will be opened in quotes, followed by a comma. 'entity',
Enter the mode in which the entity will be opened, in quotes followed by a comma. 'mode',
qbe - opens in query mode. Screens only.
list - opens in list mode. Screens only.
edit - opens in edit mode. Screens only.
new - opens in new mode. Screens only
run - opens in report mode. All entities except Screen.
param - opens the parameter form. All entities except Screen.
show - opens in the default mode defined for the entity.
Enter the height in pixels for the new entity in quotes, followed by a comma. 'height',
Enter the width in pixels for the new entity in quotes, followed by a comma. 'width',
Enter the pixel location on the screen for the top of the new entity in quotes, followed by a comma. 'top',
Enter the pixel location on the screen for the left side of the new entity in quotes, followed by a comma. 'left',
Add a close parenthesis )
Always close with a semi-colon ;
As an example, suppose that you are viewing a sales order on entity OQEM and you are going to add a link to the order line comments entity, which is an editable list.
The primary keys are order_no, order_suffix, and line_no and they are the values that need to be passed. We will set the ORG_UNIT_ID global as a temporary global.
There are four parameters to pass. Start with SetParameters.
SetParameters
Add the open parenthesis.
SetParameters(
The primary keys will be passed to the new entity, order_no, order_suffix, and line_no. Enter the block and field to which the values will be passed, in quotes followed by a comma. In this case, the block is oe_line_comments_detail. Since we are going to a screen in list mode, we want to use the block on the list that is the tied to a view. The field on the new block is ORDER_NO for the order_no primary key.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO',
The value for the order_no primary key is in the order_no field on the oedetl block of the oqem entity. It is entered next, followed by a comma.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$,
We now have to enter the order_suffix primary key information to pass it. The block and field on the entity being opened is OE_LINE_COMMENTS_DETAIL and ORDER_SUFFIX for the order_suffix primary key. It is entered next, in quotes, followed by a comma.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX',
The value for the order_suffix primary key is in the order_suffix field on the oedetl block of the oqem entity. It is entered next, followed by a comma.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX', $$OEDETL.ORDER_SUFFIX$$,
The final key being passed is the sales order line number line_no. The block and field on the entity being opened is OE_LINE_COMMENTS_DETAIL and ORDER_LINE_NO for the line_no primary key. It is entered next, in quotes, followed by a comma.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$', 'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX', '$$OEDETL.ORDER_SUFFIX$$', 'OE_LINE_COMMENTS_DETAIL.ORDER_LINE_NO',
The value for the line_no primary key is the line_no field on the oedetl block of the oqem entity. It is entered next, followed by a comma.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX', $$OEDETL.ORDER_SUFFIX$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_LINE_NO', $$OEDETL.LINE_NO$$,
Now enter the name of the global being created temporarily, preceded by an asterisk, in quotes, followed by a comma.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX', $$OEDETL.ORDER_SUFFIX$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_LINE_NO', $$OEDETL.LINE_NO$$, '*ORG_UNIT_ID',
Now enter the value to be assigned to the global, but NOT followed by a comma because it is the last value being passed.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX', $$OEDETL.ORDER_SUFFIX$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_LINE_NO', $$OEDETL.LINE_NO$$, '*ORG_UNIT_ID', $$OEDETL.ORG_UNIT_ID$$
Add the close parenthesis.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX', $$OEDETL.ORDER_SUFFIX$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_LINE_NO', $$OEDETL.LINE_NO$$, '*ORG_UNIT_ID', $$OEDETL.ORG_UNIT_ID$$)
End with a semi-colon.
SetParameters('OE_LINE_COMMENTS_DETAIL.ORDER_NO', $$OEDETL.ORDER_NO$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX', $$OEDETL.ORDER_SUFFIX$$, 'OE_LINE_COMMENTS_DETAIL.ORDER_LINE_NO', $$OEDETL.LINE_NO$$, '*ORG_UNIT_ID', $$OEDETL.ORG_UNIT_ID$$);
Xephr function |
Block and field on to which the value is being passed |
Value being passed in $$BLOCK.FIELD$$ format, or hard coded in quotes |
Block and field on to which the value is being passed. |
Value on from block being passed in $$BLOCK.FIELD$$ format or hard coded in quotes |
Block and field on to which the value is being passed. |
Value on from block being passed in BLOCK.FIELD$$ format or hard coded in quotes |
Global being created temporarily, in quotes, preceded by an asterisk |
Value on from block being set as the value of the new global in $$BLOCK.FIELD$$ format or hard coded in quotes |
SetParameters |
'OE_LINE_COMMENTS_DETAIL.ORDER_NO', |
$$OEDETL.ORDER_NO$$, |
'OE_LINE_COMMENTS_DETAIL.ORDER_SUFFIX', |
$$OEDETL.ORDER_SUFFIX$$, |
'OE_LINE_COMMENTS_DETAIL.ORDER_LINE_NO' |
$$OEDETL.LINE_NO$$, |
'*ORG_UNIT_ID', |
$$OEDETL.ORG_UNIT_ID$$); |
The new entity will be opened in a new window. Enter the Xephr function to indicate this.
ShowInWindow
Add the open parenthesis.
ShowInWindow(
Enter the entity that will be opened in quotes, followed by a comma. In this case, the entity is oe_line_comments_uvw.
ShowInWindow('OE_LINE_COMMENTS_UVW',
Enter the mode in which the entity will be opened, in quotes followed by a comma. The entity should be opened in list mode in this case
ShowInWindow('OE_LINE_COMMENTS_UVW', 'list',
Enter the height in pixels for the new entity in quotes, followed by a comma.
ShowInWindow('OE_LINE_COMMENTS_UVW', 'list', '400',
Enter the width in pixels for the new entity in quotes, followed by a comma.
ShowInWindow('OE_LINE_COMMENTS_UVW', 'list', '400', '800',
Enter the pixel location on the screen for the top of the new entity in quotes, followed by a comma. 0 indicates the very top of the screen.
ShowInWindow('OE_LINE_COMMENTS_UVW', 'list', '400', '800','0',
Enter the pixel location on the screen for the left of the new entity in quotes, followed by a comma. 0 indicates the very left of the screen.
ShowInWindow('OE_LINE_COMMENTS_UVW', 'list', '400', '800','0','0'
Add the close parenthesis.
ShowInWindow('OE_LINE_COMMENTS_UVW', 'list', '400', '800','0','0')
End with a semi-colon.
ShowInWindow('OE_LINE_COMMENTS_UVW', 'list', '400', '800','0','0');
Xephr function |
Entity being opened in new window |
Mode in which entity will be opened. |
Height of new window in pixels. |
Width of new window in pixels |
Pixel location for the top of the new window |
Pixel location of the left of the new window |
ShowInWindow |
('OE_LINE_COMMENTS_UVW', |
'list', |
'400', |
'800', |
'0', |
'0'); |
There will be times when a Xephr function will be set up to perform some action before opening a new entity, such as when you are inserting a new record. When this occurs, certain checks are done against the entity, such as checking to make sure that required fields are entered. For this reason, you should enter the javascript to be performed first. Then, you will put the code that is dependent upon the javascript executing successfully within a wrapper that checks to make sure that the javascript was successful before moving on.
Inserts, saves, and deletes set a property called lastResult. If this value is "true", the insert was successful. If the values is "false". it was unsuccessful.
The code looks like this
if ( lastResult)
{
//protected actions go here
}
For example:
Insert();
if ( lastResult)
{
SetParameters('CONTACT_MASTER.CONTACT_ID', $$CONTACT_MASTER.CONTACT_ID$$);
ShowInWindow('SPWM','edit', '400', '800','0','0');
}
Xephr is a registered trademark of NDS Systems, LC.
Copyright