Passing Values Between Entities, Remaining within the Same Window.

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 ( " ).

See Also

Passing Values between Entities

Passing Values between Entities, opening in a new window

 

  1. 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.

  2. Enter the Xephr function call for the entity that you are opening.

  1. Add an open parenthesis (

  2. Enter the entity that you are opening in quotes followed by a comma. 'entity',

  1. If you are passing values, such as primary keys, enter the block and field, in the format block.field, to which the value will be passed on the new entity, in quotes followed by a comma 'BLOCK.FIELD',

  2. If you are passing values, 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$$;

  3. 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',

  4. 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$$;

  5. Repeat 5 thorough 8 for any additional values that you are passing.  The final value will NOT be followed by a comma.

  6. When all values have been entered, add a close parenthesis )

  7. Always close with a semi-colon ;

As an example, imagine that you are viewing a list of sales orders on entity OQEM and you are going to add a link on the list block that will take you to the edit block to view a single sales order.  

ShowEdit

ShowEdit(

ShowEdit('OQEM',

ShowEdit('OQEM', 'OEHEAD.ORDER_NO',

ShowEdit('OQEM', 'OEHEAD.ORDER_NO', $$OEHEAD.ORDER_NO$$,

ShowEdit('OQEM', 'OEHEAD.ORDER_NO', $$OEHEAD.ORDER_NO$$, 'ORDER_SUFFIX',

ShowEdit('OQEM', 'OEHEAD.ORDER_NO', $$OEHEAD.ORDER_NO$$, 'OEHEAD.ORDER_SUFFIX', $$OEHEAD.ORDER_SUFFIX$$,

ShowEdit('OQEM', 'OEHEAD.ORDER_NO', $$OEHEAD.ORDER_NO$$, 'OEHEAD.ORDER_SUFFIX', $$OEHEAD.ORDER_SUFFIX$$, '*ORG_UNIT_ID',

ShowEdit('OQEM', 'OEHEAD.ORDER_NO', $$OEHEAD.ORDER_NO$$, 'OEHEAD.ORDER_SUFFIX', $$OEHEAD.ORDER_SUFFIX$$, '*ORG_UNIT_ID', ' $$OEHEAD.ORG_UNIT_ID$$

ShowEdit('OQEM', 'OEHEAD.ORDER_NO', $$OEHEAD.ORDER_NO$$, 'OEHEAD.ORDER_SUFFIX',$$OEHEAD.ORDER_SUFFIX$$, '*ORG_UNIT_ID', ' $$OEHEAD.ORG_UNIT_ID$$)

ShowEdit('OQEM', 'OEHEAD.ORDER_NO', $$OEHEAD.ORDER_NO$$, 'OEHEAD.ORDER_SUFFIX', $$OEHEAD.ORDER_SUFFIX$$, '*ORG_UNIT_ID', ' $$OEHEAD.ORG_UNIT_ID$$);

Xephr function

Entity you are going to (optional)

Block and field to which a value is being passed

Value on from block being passed in $$BLOCK.FIELD$$ format or hard coded in quotes

Block and field to which a 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

ShowEdit

('OQEM',

'OEHEAD.ORDER_NO',

$$OEHEAD.ORDER_NO$$,

'OEHEAD.ORDER_SUFFIX',

$$OEHEAD.ORDER_SUFFIX$$

'*ORG_UNIT_ID',

$$OEHEAD.ORG_UNIT_ID$$);

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)

   {

   ShowEdit('CONTACT_MASTER.CONTACT_ID','$$CONTACT_MASTER.CONTACT_ID$$');

   }

Xephr is a registered trademark of NDS Systems, LC.

Copyright © 2007 NDS Systems LC.