Kbase P23234: How to allow input of a time variable defined as integer using the HH:MM:SS format in a smart data v
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  7/24/2008 |
|
Status: Unverified
GOAL:
How to allow input of a time table field defined as integer using the HH:MM:SS format in a smart data viewer (SDV)?
FACT(s) (Environment):
Windows
Progress 9.x
FIX:
Following is a step by step procedure to accomplish this task:
1. Connect to the sports database.
2. Add an integer field iTime to the Customer table format ?99999?.
3. Create a smart data object against the customer table with Cust-Num, Name, iTime.
4. Define a calculated field called Time to the SDO as :
STRING(RowObject.jack, "HH:MM:SS"). Save the SDO.
5. Define a smart data viewer (SDV) against the above SDO and include all the fields of the SDO. You may choose to make the iTime hidden or disabled. Save the SDV.
6. Drop the above SDO and SDV on a smart window and accept the default links.
7. Drop a smart update panel and a smart navigation panel onto the smart window and accept the default links. Save the smart window application.
8. Edit the master SDO by creating an submitRow function override to make it read as follows:
RETURNS LOGICAL
( INPUT pcRowIdent AS CHARACTER,
INPUT pcValueList AS CHARACTER) :
/*------------------------------------------------------------------------------
Purpose: Super Override
Notes:
------------------------------------------------------------------------------*/
/* Code placed here will execute PRIOR to standard behavior. */
DEFINE VARIABLE iColNum AS INTEGER NO-UNDO.
DEFINE VARIABLE cColName AS CHARACTER NO-UNDO.
DEFINE VARIABLE iTime AS INTEGER NO-UNDO.
DEFINE VARIABLE c AS CHARACTER NO-UNDO.
DO iColNum = 1 TO NUM-ENTRIES(pcValueList,CHR(1)) BY 2:
cColName = ENTRY(iColNum, pcValueList,CHR(1)).
IF cColName = "cTime" THEN
c = ENTRY(iColNum + 1, pcValueList,CHR(1)).
END.
DO iColNum = 1 TO NUM-ENTRIES(pcValueList,CHR(1)) BY 2:
cColName = ENTRY(iColNum, pcValueList,CHR(1)).
IF cColName = "Jack" THEN
ENTRY(iColNum + 1, pcValueList,CHR(1)) = STRING(
INTEGER(ENTRY(1, c, ":")) * 60 * 60 +
INTEGER(ENTRY(2, c, ":")) * 60 +
INTEGER(ENTRY(3, c, ":"))).
END.
RETURN SUPER( INPUT pcRowIdent, INPUT pcValueList ).
END FUNCTION.
9. Edit the master SDV by creating a displayFields procedure override to make it read as follows:
/*------------------------------------------------------------------------------
Purpose: Super Override
Parameters:
Notes:
------------------------------------------------------------------------------*/
DEFINE INPUT PARAMETER pcColValues AS CHARACTER NO-UNDO.
/* Code placed here will execute PRIOR to standard behavior. */
RUN SUPER( INPUT pcColValues).
RowObject.jack:MODIFIED IN FRAME {&FRAME-NAME} = TRUE.
/* Code placed here will execute AFTER standard behavior. */
END PROCEDURE.
10. Save all components and Run the application. Notice that when you input new values into the calculated field the customer table time field gets updated and saved.
11. Notice that in the above solution you would want to ensure that the user does not input invalid values into the above calculated field.