Focal Point
[CLOSED]Generate email for a condition

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

November 23, 2015, 12:54 AM
swapna
[CLOSED]Generate email for a condition
How to generate emails in a Report for any conditions like
eg: State EQ 'A'

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


WebFOCUS 8.1.05
Windows 10
November 23, 2015, 01:48 AM
Ramkumar - Webfous
EDAMAIL


Excecute the EDAMAIL command inside -IF THEN ELSE conditions... May be based on &LINES.


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
November 24, 2015, 05:42 AM
swapna
Hi thanks for the Reply,
It works if not inside a IF condition after
END

But it is showing syntax error in

IF (COND01) NE C THEN

EX EDAMAIL PERSON@domain.com;,,EDAMAILTEST,A,PDF,MAIL_FILE
Is there any way to show the PCHOLD Format HTML in Else condition?

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


WebFOCUS 8.1.05
Windows 10
November 25, 2015, 09:59 AM
George Patton
You aren't at all clear about what you are trying to do, but Ramkumar is on the right track.

How about this:

a) Explain in general terms what you are trying to accomplish
b) Post the code that you have so far, so we can see what you are doing
c) When you do post the code, strip out the FILENAM.SEGNAME. part of your data fields so they don't clutter up the screen

If for example, you have a parameter, such as &PERSON, that you are using to generate your report, you would:

-SET &PERSONMAIL='&PERSON' || '@domain.com';

and use &PERSONMAIL in the EDAMAIL command.

You also aren't going to use PCHOLD, just HOLD for your HTML report

Here's some code of mine. I first of get a list of all the sales reps. Then, for each rep I create a distribution list by adding the sales rep's e-mail to those of the admin people. Then, with a -REPEAT I run the report consecutively for each rep and use EDAMAIL to distribute it. (There are limitations in WF that won't allow me to burst XLSX using ReportCaster, but I'm still using it for the scheduling function).


TABLE FILE SALES_TARGS
SUM SALESREP
BY SALESREP NOPRINT
ON TABLE HOLD AS ALLREPS FORMAT ALPHA
END

-SET &NUMREPS=&LINES;
-SET &ADMIN_EMAILS='gp@xxxxx.net; js@yyyyyy.com; rc@yyyyyy.com;';
-SET &REPDATE=EDIT(&YYMD, '9999-99-99');

-RUN

-READFILE ALLREPS
-REPEAT ENDREPEAT &NUMREPS TIMES

-SET &SUBJECT='Targets and Sales for ' | &SALESREP | ' ' | &REPDATE;

-SET &SREP_EMAIL=LOCASE(3, &SALESREP, 'A3') || '@yyyyy.com';

-SET &ALL_EMAILS=&SREP_EMAIL || ';' | &ADMIN_EMAILS;

-* Generate the report here and:

ON TABLE HOLD AS 'Targets and Sales for &SALESREP &REPDATE' FORMAT EXL07


EX EDAMAIL &ALL_EMAILS, ReportCaster@chemo.com, &SUBJECT,a,XLSX,baseapp/Targets and Sales for &SALESREP &REPDATE
-RUN
-READFILE ALLREPS
-ENDREPEAT
-RUN


Now you may suggest that I haven't addressed your IF condition, but in a way I have. By creating a list of sale reps and running the report only if a rep is in that list, I have created a condition. My example is probably more complex than you need (my actual report is 890 lines long) and you can create a condition without the -REPEAT.

This message has been edited. Last edited by: George Patton,


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP