Focal Point
[SOLVED] Schedule Duplicating Records

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

November 05, 2019, 04:39 PM
ModGuy31
[SOLVED] Schedule Duplicating Records
I'm receiving a scheduled report that I made just fine. However, the report window displays a copy of the report for some reason. It doesn't do this when I run the report in AppStudio, just when I receive the schedule through email. Code is below.

-SET &ECHO=ON;
SET EMPTYREPORT=ON
SET ASNAMES=ON
SET LINES=99999


TABLE FILE CUSTOMERS
SUM
CNT.CUSTOMERS.CUSTOMERS.FIELD1 AS 'COUNTS'
BY CUSTOMERS.CUSTOMERS.FIELD1
WHERE TOTAL CNT.CUSTOMERS.CUSTOMERS.FIELD1 GT 1;
WHERE CUSTOMERS.CUSTOMERS.FIELD1 IS NOT '';
WHERE CUSTOMERS.CUSTOMERS.CUSTOMERID IS NOT '';
ON TABLE HOLD AS MASTER
END
-RUN


JOIN
CUSTOMERS.CUSTOMERS.FIELD1 IN CUSTOMERS TO MULTIPLE
MASTER.MASTER.FIELD1
IN MASTER TAG J1 AS J1
END


TABLE FILE CUSTOMERS
PRINT
J1.MASTER.FIELD1 AS 'LEGACYID'
CUSTOMERS.CUSTOMERS.CUSTOMERID
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE PCHOLD FORMAT HTML
END
-RUN
-EXIT

This message has been edited. Last edited by: FP Mod Chuck,
November 05, 2019, 05:49 PM
Hallway
Are you wanting to see the report as an attachment in the email rather than embedded in the email?

If so, then go to the scheduled job and open it up. Go to the Distributions tab and open the method. Then in the email information about halfway down, change the radio button to 'Send all reports as attachments'




Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
November 05, 2019, 06:00 PM
ModGuy31
Hi Hallway,

Actually, I am receiving the report as an attachment, which is good. But the values within that report are duplicated. For example, when I review the results window, I should see;


LEGACYID CUSTOMERID
GSX010259 2552723
GSX010259 2696311

But what I'm getting instead is;

LEGACYID CUSTOMERID
GSX010259 2552723
GSX010259 2696311
LEGACYID CUSTOMERID
GSX010259 2552723
GSX010259 2696311
November 05, 2019, 06:21 PM
Hallway
Can you replicate the error using a master file from the ibisamp library? Like the car file? That way we can run it locally and better troubleshoot.


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
November 05, 2019, 06:23 PM
Hallway
quote:
IS NOT ''

Also, maybe try using NE '' instead.
WHERE CUSTOMERS.CUSTOMERS.CUSTOMERID NE '';
  



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
November 06, 2019, 07:23 AM
MartinY
Since MASTER file become your main selection table : it's the file that contain only the key field that you want, try with the below JOIN instead (also have included Hallway suggestion).
I would not be surprise that the problem is the JOIN … MULTIPLE

Another point is that in your original JOIN the child file (MASTER) is a none indexed alpha file. This may also cause issue in a JOIN

TABLE FILE CUSTOMERS
SUM CNT.CUSTOMERS.CUSTOMERS.FIELD1 AS 'COUNTS'
BY CUSTOMERS.CUSTOMERS.FIELD1 
WHERE TOTAL CNT.CUSTOMERS.CUSTOMERS.FIELD1 GT 1;
WHERE CUSTOMERS.CUSTOMERS.FIELD1 NE '';
WHERE CUSTOMERS.CUSTOMERS.CUSTOMERID NE '';
ON TABLE HOLD AS MASTER
END
-RUN

JOIN MASTER.MASTER.FIELD1 IN MASTER TAG T1
  TO CUSTOMERS.CUSTOMERS.FIELD1 IN CUSTOMERS TAG T2 AS J1
END

TABLE FILE CUSTOMERS
PRINT T1.FIELD1 AS 'LEGACYID'
      T2.CUSTOMERID
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE PCHOLD FORMAT HTML
END
-RUN



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
November 06, 2019, 01:19 PM
Frans
or only adjust the join:
JOIN
CUSTOMERS.CUSTOMERS.FIELD1 IN CUSTOMERS TO UNIQUE
MASTER.MASTER.FIELD1
IN MASTER TAG J1 AS J1
END  



Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.