Kbase 34301: ADM2: How to reposition Smart Objects to a particular record created during endTransactionValidate.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
Solution ID: P4301
GOAL:
ADM2: How to reposition Smart Objects to a particular record created during endTransactionValidate.
FACT(s) (Environment):
Progress 9.X
FIX:
1) In endTransactionValidate of the SDO, set a property called 'RepToThisRowidPlease' in a data-link Smart Object with the adm2 function assignLinkProperty. (requires to create set[propname] and get[propname] in the linked smart object).
DEFINE BUFFER bcust FOR customer.
DEFINE VARIABLE cRowid AS CHARACTER NO-UNDO.
/* for each newly added record Create 2 new records that end with 0 and 2*/
FOR EACH RowObjUpd WHERE RowObjUpd.RowMod = "A":
CREATE bcust.
BUFFER-COPY RowObjUpd EXCEPT RowObjUpd.custnum TO bcust
ASSIGN bcust.NAME = SUBSTR(RowObjUpd.NAME,1,LENGTH(RowObjUpd.NAME) - 1)<
+ "0".
/*=> Let's say we will reposition to this one*/
cRowid = STRING(ROWID(bcust)).
CREATE bcust.
BUFFER-COPY RowObjUpd EXCEPT custnum TO bcust
ASSIGN bcust.NAME = SUBSTR(RowObjUpd.NAME,1,LENGTH(RowObjUpd.NAME) - 1)<
+ "2".
END.
DYNAMIC-FUNCTION('assignLinkProperty':U,
INPUT 'Data-Target':U /* CHARACTER */,
INPUT 'RepToThisRowidPlease':U /* CHARACTER */,
INPUT cRowid /* CHARACTER */).
END PROCEDURE.
2) Do an override of updateRecord, then use fetchRowIdent on the ROWID stored in the property:
In linked viewer, override of updateRecord:
/* Code placed here will execute PRIOR to standard behavior. */
DEFINE VARIABLE lcRowIdent AS CHARACTER NO-UNDO.
DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
RUN SUPER.
/* Code placed here will execute AFTER standard behavior. */
hDataSource = DYNAMIC-FUNCTION('getDataSource').
/* if property RepToThisRowidPlease not empty, then reposition to it*/
lcRowIdent = getRepToThisRowidPlease().
IF lcRowIdent <> ""
AND lcRowIdent <> DYNAMIC-FUNCTION('getRowIdent':U IN hDataSource) THEN DO:
MESSAGE lcRowIdent SKIP DYNAMIC-FUNCTION('getRowIdent':U IN hDataSource)
VIEW-AS ALERT-BOX INFO BUTTONS OK.
DYNAMIC-FUNCTION('openQuery':U IN hDataSource).
DYNAMIC-FUNCTION('fetchRowIdent':U IN hDataSource,
INPUT lcRowIdent,
INPUT '').
setRepToThisRowidPlease(""). /*Clear this property now!*/
END.
END PROCEDURE.
In the viewer again. Define variable RepToThisRowidPlease AS CHAR in the definition block of the view. Make the setRepToThisRowidPlease() and getRepToThisRowidPlease() function to set or query this variable.