Search code examples
stringvariablesoracle11gwebfocus

How are &VARCHARs handled in WebFOCUS?


I need a definitive explanation of how strings are handled in WebFOCUS Developer Studio, especially between a launch page and the report itself. I cannot find a good explanation in the documentation of how they are handled in general.

My issue comes down to single quotes, but I'm not sure when, where, or why they are added and removed. Is there an issue with using a &variable in a define when multiple values are sent? I thought this was just processed as <option1> OR <option2> OR ...

More specifically: in the report I am working on, I have a list box control on a launch page, where the user can select one or more employees to query their VOIP records. As the HTM/FEX is configured now, the report shows records for a single employee selected but nothing when multiple employees are selected. I can't figure out a way to make this work for more than one person selected. It might be something with my define.

DEFINE FILE TABLE_NAME ADD
  EMPLOYEE/A55V=
    IF (&EMP_NAME EQ CALLING_PARTY) THEN &EMP_NAME ELSE
    IF (&EMP_NAME EQ ORIGINAL_CALLED) THEN &EMP_NAME ELSE
    IF (&EMP_NAME EQ FINAL_CALLED) THEN &EMP_NAME ELSE 'X';
END

TABLE FILE HOLD_VOIP_DATE_RANGE

PRINT 
 TABLE_NAME.SEG01.EMPLOYEE
 TABLE_NAME.SEG01.CALLING_PARTY AS 'Rep'
 TABLE_NAME.SEG01.ORIGINAL_CALLED
 TABLE_NAME.SEG01.FINAL_CALLED
 TABLE_NAME.SEG01.ORIGINATION_TIME
 TABLE_NAME.SEG01.CONNECT_TIME
 TABLE_NAME.SEG01.DISCONNECT_TIME
 TABLE_NAME.SEG01.ORIGINATION_DATE
 TABLE_NAME.SEG01.CALL_TYPE
WHERE EMPLOYEE EQ &EMP_NAME;

NOTE: Multiple Add Quotes property on the list box is set to 'ON'.

Feedback is welcome. This is my first question on SE. Let me know if I need to be more specific.


Solution

  • Web focus &Variables work as a text replace

    -SET &EMP_NAME = 'Bruce Wayne';    
    DEFINE FILE TABLE_NAME ADD
      EMPLOYEE/A55V=
        IF (&EMP_NAME EQ CALLING_PARTY) THEN &EMP_NAME ELSE
        IF (&EMP_NAME EQ ORIGINAL_CALLED) THEN &EMP_NAME ELSE
        IF (&EMP_NAME EQ FINAL_CALLED) THEN &EMP_NAME ELSE 'X';
    END
    
    TABLE FILE HOLD_VOIP_DATE_RANGE
    
    PRINT 
     TABLE_NAME.SEG01.EMPLOYEE
     TABLE_NAME.SEG01.CALLING_PARTY AS 'Rep'
     TABLE_NAME.SEG01.ORIGINAL_CALLED
     TABLE_NAME.SEG01.FINAL_CALLED
     TABLE_NAME.SEG01.ORIGINATION_TIME
     TABLE_NAME.SEG01.CONNECT_TIME
     TABLE_NAME.SEG01.DISCONNECT_TIME
     TABLE_NAME.SEG01.ORIGINATION_DATE
     TABLE_NAME.SEG01.CALL_TYPE
    WHERE EMPLOYEE EQ &EMP_NAME;
    

    Will look like this once executed

    -SET &EMP_NAME = 'Bruce Wayne';    
    DEFINE FILE TABLE_NAME ADD
      EMPLOYEE/A55V=
        IF (Bruce Wayne EQ CALLING_PARTY) THEN Bruce Wayne ELSE
        IF (Bruce Wayne EQ ORIGINAL_CALLED) THEN Bruce Wayne ELSE
        IF (Bruce Wayne EQ FINAL_CALLED) THEN Bruce Wayne ELSE 'X';
    END
    
    TABLE FILE HOLD_VOIP_DATE_RANGE
    
    PRINT 
     TABLE_NAME.SEG01.EMPLOYEE
     TABLE_NAME.SEG01.CALLING_PARTY AS 'Rep'
     TABLE_NAME.SEG01.ORIGINAL_CALLED
     TABLE_NAME.SEG01.FINAL_CALLED
     TABLE_NAME.SEG01.ORIGINATION_TIME
     TABLE_NAME.SEG01.CONNECT_TIME
     TABLE_NAME.SEG01.DISCONNECT_TIME
     TABLE_NAME.SEG01.ORIGINATION_DATE
     TABLE_NAME.SEG01.CALL_TYPE
    WHERE EMPLOYEE EQ Bruce Wayne;
    

    My guess is that you are missing extra quotes outside the &variable