Focal Point
[solved]wrong data type received in the drill-down procedure. Help!

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

September 16, 2008, 03:06 PM
Hua
[solved]wrong data type received in the drill-down procedure. Help!
I have created a drill-down procedure that accepts 3 parameters:

-SET &ECHO = ON;
-DEFAULT &SELECTED_REP = 'FOC_NONE';
-DEFAULT &CUR_DATE = 0;
-DEFAULT &PRV_DATE = 0;
-TYPE Rep Unit: &SELECTED_REP.(OR(FIND REPUNIT IN IT0307P)).Rep Unit.
-TYPE Current date: &CUR_DATE.(FIND CCDATE IN IT0307P).Current date.
-TYPE Previous date: &PRV_DATE.(FIND CCDATE IN IT0307P).Previous date.

If I call this procedure stand-a-lone, I got the proper values:
Rep Unit: '01000159'
Current date: 1080915
Previous date: 1080914

But if I drill-down from another procedure, I got this:
Rep Unit: 01000159
Current date: 1080915
Previous date: 1080914

The Rep Unit from the calling procedure is also defined as ALPHA, but the contents are all digits. How do I ensure that the parameter &SELECTED_REP will always receive ALPHA values?

Thanks.

Hua

This message has been edited. Last edited by: Hua,


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
September 16, 2008, 03:17 PM
GinnyJakes
Did you try putting single quotes around &SELECTED_REP in your WHERE clause?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
September 16, 2008, 03:31 PM
Hua
Thank you Ginny.

I did not put quotes around &SELECTED_REP in the WHERE clause. Now that I put them in, the drill-down is OK but calling it by itself is a problem.


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
September 16, 2008, 03:41 PM
j.gross
If the parameter values overriding the default are guaranteed to be
either nicely quoted values or expressions like
'123456'
or
'12345' OR '23456'
or else simple unquoted values like
123456

then adding this code should do it:

-SET &SELECTED_REP = IF EDIT(&SELECTED_REP,'9') EQ '''' THEN &SELECTED_REP ELSE '''' | &SELECTED_REP | '''';


[Toss in -? &SEL before and after to see what it's doing.]


- Jack Gross
WF through 8.1.05
September 16, 2008, 03:47 PM
GinnyJakes
That is a common problem, Hua.

Jack's suggestion is a good one that I'll take advantage of in the future. Good One


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
September 16, 2008, 03:53 PM
Darin Lee
One thing that you may want to look into is the .QUOTEDSTRING operator - from the manual:
The QUOTEDSTRING suffix on a Dialogue Manager variable applies the following two conversions to the contents of the variable:

Any single quotation mark embedded within a string is converted to two single quotation marks.

Single quotation marks are added around the string.

Dialogue Manager commands differ in their ability to handle character strings that are not enclosed in single quotation marks and contain embedded blanks. An explicit or implied -PROMPT command can read such a string. The entire input string is then enclosed in single quotation marks when operated on by .QUOTEDSTRING.

Without seeing all of your code for the calling and called procedure it's difficult to give a more specific resolution.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
September 16, 2008, 03:55 PM
Hua
Thanks a lot.
Never thought it would be this simple!

Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
September 16, 2008, 05:40 PM
Hua
Darin,

I tried using your technique of the QUOTESTRING suffix and have trouble making it work.

The original codes of the calling procedure:***************************************

TABLE FILE H_CREPS
PRINT
'ITMRVAL0.ITMRVAL0.ITDSAD'
'H_CREPS.SEG01.CMATTL' AS 'Total,Current,Material Costs'
'H_PREPS.SEG01.CMATTL' AS 'Total,Previous,Material Costs'
'H_PREPS.SEG01.costchg' AS 'Cost,Changed'
'H_CREPS.SEG01.CCDATE' NOPRINT
'H_PREPS.SEG01.CCDATE' NOPRINT
BY 'H_CREPS.SEG01.REPUNIT'
ON TABLE SUBHEAD
"Run date: <+0>&DATEtMDYY <+0> "
" "
" "
HEADING
"Rep units with Material Cost Changed"
"Current(FOOTING
""
ON TABLE SUBFOOT
"'****** END OF DATA*********'"
" "
WHERE ( H_PREPS.SEG01.costchg GT 1 ) OR ( H_PREPS.SEG01.costchg LT -1 );
WHERE ITMRVAL0.ITMRVAL0.STIDAD EQ 'VER';
ON TABLE SET EMPTYREPORT ANSI
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
$
TYPE=DATA,
COLUMN=N1,
FOCEXEC=app/pcc005(SELECTED_REP=N1 CUR_DATE=N6 PRV_DATE=N7),
$



Portion of the pcc005 codes **********************************

-SET &ECHO = ON;
-DEFAULT &SELECTED_REP = 'FOC_NONE';
-DEFAULT &CUR_DATE = 0;
-DEFAULT &PRV_DATE = 0;
-TYPE Rep Unit: &SELECTED_REP.(OR(FIND REPUNIT IN IT0307P)).Rep Unit.
-TYPE Current date: &CUR_DATE.(FIND CCDATE IN IT0307P).Current date.
-TYPE Previous date: &PRV_DATE.(FIND CCDATE IN IT0307P).Previous date.
-*(Jack suggested) SET &SELECTED_REP = IF EDIT(&SELECTED_REP,'9') EQ '''' THEN &SELECTED_REP ELSE '''' | &SELECTED_REP | '''';
TABLE FILE IT0306P
PRINT
'IT0306P.IT0306P.CCDATE'
'IT0306P.IT0306P.REPUNIT'
'IT0306P.IT0306P.CINBR'
'IT0306P.IT0306P.ITDSC'
'IT0306P.IT0306P.QTYPR'
'IT0306P.IT0306P.CMAT'
HEADING
"Current snapshot of the component costs "
FOOTING
""
WHERE IT0306P.IT0306P.REPUNIT EQ &SELECTED_REP;
WHERE IT0306P.IT0306P.CCDATE EQ &CUR_DATE;
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS H_CCOMP FORMAT FOCUS INDEX 'IT0306P.IT0306P.REPUNIT' 'IT0306P.IT0306P.CINBR'
ON TABLE SET HTMLCSS ON
END


Hope the codes are not too confusing. Thanks.

Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
September 16, 2008, 06:57 PM
Darin Lee
Try

WHERE IT0306P.IT0306P.REPUNIT EQ '&SELECTED_REP';
WHERE IT0306P.IT0306P.CCDATE EQ '&CUR_DATE';

I noticed you are passing a parameter of &PRV_DATE but it does not appear in your code anywhere.

The .QUOTEDSTRING is usually only used when passing a literal value, instead of a column value so that probably is not the direction to go in this case.

I would also comment out the -TYPE statements when testing standalone and just set some appropriate default values that appear in your first report.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
September 17, 2008, 03:42 AM
Tony A
Surely you should be able to use -
WHERE IT0306P.IT0306P.REPUNIT EQ &SELECTED_REP.QUOTEDSTRING

N'est pas?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 17, 2008, 09:41 AM
Hua
Thank you everyone for your input.

Just like mention what is working in this case.
I tried:
WHERE IT0306P.IT0306P.REPUNIT EQ &SELECTED_REP.QUOTEDSTRING
or
WHERE IT0306P.IT0306P.REPUNIT EQ '&SELECTED_REP'
and
TYPE=DATA,
COLUMN=N1,
FOCEXEC=app/pcc005(SELECTED_REP=N1.QUOTESTRING CUR_DATE=N6 PRV_DATE=N7),
$
all the above not working.

Jack's suggestion is working perfectly for me. I just hoping the QUOTESTRING would work so that I don't have to explicitly massage the data. Anyway, my case is simply enough and happy to take it.

Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS