Focal Point
[CLOSED]Need Help in the following code

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

January 26, 2016, 08:57 AM
N/A
[CLOSED]Need Help in the following code
Hello,
I am a beginner in web Focus and creating report. The purpose of the code is
If Type of coverage is Assistant Living Care then show only 'Assistant Living care Cov Amount' and 'AssistantLiving Care Term Premium'.

IF &P_Type Of Cov EQ 'AssistedLivingCare' THEN GO TO LBL 'Assisted Living Care'
-LBL AsssitedLivingCare
'AssitedlivingCare CovAmount'
'AssistedLivingCare TermPremium'
-GOTO LBL DONE CHECKING

I am getting error
regards,
Niharika

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8
Windows 7
HTML
January 26, 2016, 09:40 AM
BabakNYC
You populate an &Variable with a prompt and then use it in a WHERE FIELD EQ &Variable within the request as a filter.

TABLE FILE CAR
SUM CAR.BODY.DEALER_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
BY CAR.BODY.BODYTYPE

WHERE CAR.BODY.BODYTYPE EQ '&BODYTYPE.BODYTYPE:.';
ON TABLE PCHOLD FORMAT HTML
END

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


WebFOCUS 8206, Unix, Windows
January 26, 2016, 10:16 AM
MartinY
Hi Niharika and welcome in FOCUS world.

First not sure of what you want to do with
quote:

IF &P_Type Of Cov EQ 'AssistedLivingCare' THEN GO TO LBL 'Assisted Living Care'
-LBL AsssitedLivingCare
'AssitedlivingCare CovAmount'
'AssistedLivingCare TermPremium'
-GOTO LBL DONE CHECKING

But it certainly not working in FOCUS. It should be something like this
-DEFAULT &P_Type_Of_Cov = 'AssistedLivingCare'

-IF &P_Type_Of_Cov EQ 'AssistedLivingCare' THEN GOTO LBL_ALC;
-LBL_ALC
-TYPE 'AssitedLivingCare CovAmount'
-TYPE 'AssistedLivingCare TermPremium'
-GOTO LBL_DONE;
-LBL_DONE

Under LBL_ALC you cannot just put text without a verb. The -TYPE verb is used to display the text or variable.
Also, you are limited on the label length, format and characters that you can used.

Without knowing exactly what you want to do in you LBL_ALC, is difficult to help.

Try to gives us an example using one the IBI sample file such as CAR file.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
January 26, 2016, 01:19 PM
N/A
quote:
Hi Niharika and welcome in FOCUS world.First not sure of what you want to do withquote:IF &P_Type Of Cov EQ 'AssistedLivingCare' THEN GO TO LBL 'Assisted Living Care'-LBL AsssitedLivingCare 'AssitedlivingCare CovAmount' 'AssistedLivingCare TermPremium'-GOTO LBL DONE CHECKING But it certainly not working in FOCUS. It should be something like this-DEFAULT &P_Type_Of_Cov = 'AssistedLivingCare'

-IF &P_Type_Of_Cov EQ 'AssistedLivingCare' THEN GOTO LBL_ALC;
-LBL_ALC
-TYPE 'AssitedLivingCare CovAmount'
-TYPE 'AssistedLivingCare TermPremium'
-GOTO LBL_DONE;
-LBL_DONE
Under LBL_ALC you cannot just put text without a verb. The -TYPE verb is used to display the text or variable.Also, you are limited on the label length, format and characters that you can used.Without knowing exactly what you want to do in you LBL_ALC, is difficult to help.Try to gives us an example using one the IBI sample file such as CAR file.WF 7.7.03 (not even WF8) AS400/WindowsIn Focus since 2007



WebFOCUS 8
Windows 7
HTML
January 26, 2016, 01:22 PM
N/A
Thanks. I will try to elaborate with examples so that It will be fixed.
Niharika


WebFOCUS 8
Windows 7
HTML
January 26, 2016, 02:17 PM
N/A
quote:
Originally posted by MartinY:
Hi Niharika and welcome in FOCUS world.

First not sure of what you want to do with
quote:

IF &P_Type Of Cov EQ 'AssistedLivingCare' THEN GO TO LBL 'Assisted Living Care'
-LBL AsssitedLivingCare
'AssitedlivingCare CovAmount'
'AssistedLivingCare TermPremium'
-GOTO LBL DONE CHECKING

But it certainly not working in FOCUS. It should be something like this
-DEFAULT &P_Type_Of_Cov = 'AssistedLivingCare'

-IF &P_Type_Of_Cov EQ 'AssistedLivingCare' THEN GOTO LBL_ALC;
-LBL_ALC
-TYPE 'AssitedLivingCare CovAmount'
-TYPE 'AssistedLivingCare TermPremium'
-GOTO LBL_DONE;
-LBL_DONE

Under LBL_ALC you cannot just put text without a verb. The -TYPE verb is used to display the text or variable.
Also, you are limited on the label length, format and characters that you can used.

Without knowing exactly what you want to do in you LBL_ALC, is difficult to help.

Try to gives us an example using one the IBI sample file such as CAR file.



Hello Martin,
I want to dynamically place fields on reports based values of variables. One option is all fields...so I have some common fields , I need to dynamically add fields to report. Is it clear?
REgards,
Niha


WebFOCUS 8
Windows 7
HTML
January 26, 2016, 02:41 PM
MartinY
Maybe this may help given that I understand that you want to create kind of Ad Hoc reporting

Ad Hoc part I
Ad Hoc part II

But there is several way to answer your need and it may be the easiest one if you don't have that much experience with FOCUS.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
January 26, 2016, 03:12 PM
Waz
Niharika,

I think you need some basic training.

The Dialog manager you posted is by no means correct.

You have also not posted the error.

I would always suggest that if you have an issue, repro it with one of the sample files and post the whole code. Makes it easier for us to determine what is wrong.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 26, 2016, 06:39 PM
CTM2015
Hi Waz..

I work with Niharika.. I know what she is trying to do.

She is junior level and has less than 4 months on WF.. so she is trying. And needs guidance from senior level guys like you, Martin and BabakNYC.

What she needs to accomplish is for a drill down report that is drilled to from 3 summary reports, she needs to display different fields in the detail report.

So if she clicks on 1 column, she will get a detail report with Columns A, B, C, D,E, F ... then if she clicks on column 2 then she needs a detail report with Columns A, B, C, D, H, I, J, K, L... and a 3rd report drills to
columns A, B, C, D, X, Y,Z...

so the idea is to achieve this with Print A,B,C, D and then do DMgr and based on a variable show EF or GHIJKL or XYZ.. and if column4 is clicked then columns ABCDEFGHIJKLXYZ are displayed.
January 26, 2016, 07:12 PM
Waz
Hi CTM2015, Niharika.

I would still suggest basic training on dialog manager. As a minimum there are many examples on the forum, and also in the sample fexes suplied with a WebFOCUS installation.

There are several ways to do this.

The simplest is to do the IF GOTO option.

e.g.
TABLE FILE Blah
PRINT FLD1
-IF &TEST EQ '1' THEN GOTO 1Cont ;
FLD2
FLD3
-1Cont
FLD4
FLD5
BY FLD0
etc
END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 27, 2016, 06:51 AM
Danny-SRL
Less than 4 months... and how much training, courses, ppt, pdf?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

January 27, 2016, 11:06 AM
N/A
Thanks a lot for all your help! I have taken Report Essential 1 and Report Essential 2 training from IBI and I have created 3 to 4 basic reports and also HTML.
Regards,
Niha


WebFOCUS 8
Windows 7
HTML
January 27, 2016, 04:09 PM
Waz
Sounds like you have been thrown in the deep end.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 28, 2016, 11:56 AM
eric.woerle
You have one other option. You could look at this like a guided adhoc report and pass the fields from the parent to the child report through the drill down.

The child report would look something like this:

TABLE FILE MYTABLE
PRINT
&MYFIELDS.EVAL
BY FIELD1
BY FIELD2
ETC
END  


This way you don't need to worry about GOTO's or anything like that. In your parent drill down you would just need to add MYFIELD="A B C D ETC"


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
January 28, 2016, 04:00 PM
Waz
The other way is to generate comment variables to control what is seen.

-SET &FLD2Ctrl = IF {condition} THEN '-*' ELSE '' ;
-SET &FLD3Ctrl = IF {condition} THEN '-*' ELSE '' ;
TABLE FILE Blah
PRINT FLD1
&FLD2Ctrl.EVAL FLD2
&FLD3Ctrl.EVAL FLD3
FLD4
FLD5
BY FLD0
etc
END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

February 01, 2016, 09:31 AM
N/A
Thanks. Let see if it helps.
Niharika


WebFOCUS 8
Windows 7
HTML