Kbase P18301: How to move a SmartDataBrowser record up to the top of the v
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/3/2003 |
|
Status: Unverified
GOAL:
How to move the current SmartDataBrowse record up.
FACT(s) (Environment):
Windows
FACT(s) (Environment):
Progress 9.x
FIX:
1. Create a SmartDataObject(SDO) against the Customer table.
2. Create a SmartDataBrowser against the SDO.
3. Drop Both onto a SmartWindowObject and accept the default link.
4. Drop a button on the window with the following code behind its CHOOSE event:
/* Button to move a record UP */
DO:
DEF VAR cRowID AS CHAR NO-UNDO. /* Current record rowed */
DEF VAR iMySeq AS INT NO-UNDO. /* Key to current record */
DEF VAR iPrevSeq AS INT NO-UNDO. /* Key of previous record */
IF can-do("NoRecordAvailable,OnlyRecord,FirstRecord", DYNAMIC-FUNCTION('getQueryPosition' IN h_dcust2000)) THEN
RETURN.
/* Move the current record to sequence 0 */
iMySeq = INT(ENTRY(2,DYNAMIC-FUNCTION('colValues' IN h_dcust2000,"CustNum"),CHR(1))).
cRowId = DYNAMIC-FUNCTION('getRowIdent':U IN h_dcust2000).
DYNAMIC-FUNCTION('submitRow' IN h_dcust2000, cRowID,"CustNum" + CHR(1) + "0").
/* Move the previous record to the current record's Key */
RUN fetchPrev IN h_dcust2000.
iPrevSeq = INT(ENTRY(2,DYNAMIC-FUNCTION('colValues' IN h_dcust2000,"CustNum"),CHR(1))).
cRowId = DYNAMIC-FUNCTION('getRowIdent':U IN h_dcust2000).
DYNAMIC-FUNCTION('submitRow' IN h_dcust2000, cRowID,"CustNum" + CHR(1) + STRING(iMySeq)).
/* now move record at sequence 0 to the previous records position */
RUN fetchNext IN h_dcust2000.
cRowId = DYNAMIC-FUNCTION('getRowIdent':U IN h_dcust2000).
DYNAMIC-FUNCTION('submitRow' IN h_dcust2000, cRowID,"CustNum" + CHR(1) + STRING(iPrevSeq)).
DYNAMIC-FUNCTION('setQueryRowIdent':U IN h_dcust2000,cRowID).
DYNAMIC-FUNCTION('openQuery':U IN h_dcust2000).
END.