Focal Point
empty fields

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7341070022

March 26, 2007, 04:03 AM
FrankDutch
empty fields
I'm building a fex that needs an address field.

The address is build out of several components (alphanumeric) which are sometimes empty.
We want a comma in between the componants, but if a field is empty, we now get two comma's.
How can we avoid that.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

March 26, 2007, 04:16 AM
Alan B
A piece of code I have had for years:
  
-*N Shuffle sort addresses to strip out blank lines
    P_ADDRESS_1/A31  = IF P.ADDRESS_1 EQ ' '
                         THEN ' '
                         ELSE P.ADDRESS_1||',';
    P_ADDRESS_2/A31  = IF P.ADDRESS_2 EQ ' '
                         THEN ' '
                         ELSE P.ADDRESS_2||',';
    P_ADDRESS_3/A31  = IF P.ADDRESS_3 EQ ' '
                     THEN ' '
                         ELSE P.ADDRESS_3||',';
    P_TOWN     /A21  = IF P.TOWN EQ ' '
                     THEN ' '
                     ELSE P.TOWN||'~';
    P_COUNTRY  /A21  = IF P.COUNTRY EQ ' '
                         THEN ' '
                         ELSE P.COUNTRY||',';
    P_ADDRESS_PC/A16  = IF P.ADDRESS_PC EQ ' '
                         THEN ' '
                         ELSE P.ADDRESS_PC||',';
    P_ADDRESS_STR/A160= P_ADDRESS_1||
                        P_ADDRESS_2||
                        P_ADDRESS_3||
                        P_TOWN||
                        P_COUNTRY||
                        P_ADDRESS_PC;

A better way may be to concatenate them all with commas and use STRREP to replace 2 commas with one.

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
March 26, 2007, 10:07 AM
Leah
As Alan says, define/computes is the way, on the STRREP I've never used it. Thanks Alan, for a new possiblility. We have to handle US and international addresses here at the university and use code similar to Alan's all the time.


Leah