| Reader's Clinic - Different Id Same Record |
| Reader's Clinic - Scaled Masked Decimal Conversions |
| Base Conversions |
| User Defined Conversions |
| Reader's Forum - Numeric Precision in R/Basic - Hal Wyman |
| Playing with Scan Codes |
| QTIPS - Compiling Protection Code |
| QTIPS - Invalid Code and Command |
| QTIPS - Code/Command Help |
| Compiling 64K on a Shoestring by Blaise Wrenn (LexStat Systems Ltd) |
| QTIPS - Using @Upper.Case and @Lower.Case with Foreign Languages |
| @ATTACK - @Lower.Case |
| @ATTACK - @Upper.Case |
| Sorting out Collation Sequences by Mike Pope |
| Version 2 |
| RTP Series - RTP19 |
| VERBatim - V22 |
| Reader's Clinic - Scaled Masked Decimal Conversions |
| VROOM - Window Processing II |
| Base Conversions |
| IConvs / OConvs |
| User Defined Conversions |
| SecureUser |
| VERBatim - V25 |
| @ATTACK - @Files.System |
| Advanced Revelation Initialisation Sequence (Overview) by Mike Pope |
| REVMEDIA Revisted |
| Form.List.S |
| QTIPS - Aesthetically Improving RLIST Reports |
| QTIPS - Form Processor |
| QTIPS - Suppressing Initial Form Feed |
| QTIPS - Using RTP29 In Place of V6 |
RevMedia FKB
| Document | V3I1A2 |
| Title | User Defined Conversions |
| Keywords | CONVERSION OCONV ICONV |
| Text | One of the most common forms of user DEFINED conversion is that which takes a code and USING it extracts a description FROM a code table for display For example SUBROUTINE CODE_LOOKUP(TYPE PASSED BRANCH RETURNED) BEGIN CASE CASE TYPE = "ICONV" * Assuming codes are MVs in field 5 and descs in 6 CODES = XLATE("CODES" BRANCH[ 1 "B*"] 5 "X") LOCATE PASSED IN CODES USING @VM SETTING POS THEN STATUS() = 0 END ELSE STATUS() = 1 ; PASSED = "" END RETURNED = PASSED CASE TYPE = "OCONV" CODES = XLATE("CODES" BRANCH[ 1 "B*"] "" "X") LOCATE PASSED IN CODES<5> USING @VM SETTING POS THEN RETURNED = CODES<6 POS> END ELSE RETURNED = PASSED END END CASE RETURN Note that in this EXAMPLE the DATA logic is kept separate FROM the APPLICATION logic (the ICONV itself does not suggest replacements it flags that an error has occurred and lets the application logic suggest alternatives This leads to more portable code (see future articles on system design)) However when the user presses Ctrl F10 and then F2 the uncoded version shows up If the user then chooses the uncoded version the OCONV logic is invoked and it redisplays as the coded version If the user then selects this version and F9s it the system attempts to re ICONV the OCONVed value even though the internal form is available fails to ICONV it and thus finds no hits To fix this problem amend the code as follows : CODES = XLATE("CODES" BRANCH[ 1 "B*"] "" "X") LOCATE PASSED IN CODES<5> USING @VM SETTING POS THEN RETURNED = PASSED END ELSE LOCATE PASSED IN CODES<6> USING @VM SETTING POS THEN RETURNED = CODES<5 POS> END ELSE STATUS() = 1 ; RETURNED = "" END END (Volume 3 Issue 1 Page 7) |
Page last modified: 08/02/03