简体   繁体   中英

SSRS Report Duplicates Flag

I'm presently making a report on ssrs from a Great Plains Dynamics DB.

It's a pretty simple report with a few columns. Everything works fine but in GP, when creating an Invoice or a Return bill, sometimes GP is gonna give the same Bill ID. It doesn't really shows as a duplicated because for GP, an Invoice and a Return can/could have the same ID because they are not the same type. Don't ask me why..

So for my report, when I start a research from a multiples values parameters with my SopNumber (Bill ID) it gives me the right information. But now I would like to have a flag on those information that equals the bill ID and has Invoice and Return at the same time.

Since it is normal for GP to have 2 different type of document for the same ID, I cannot ask my report to remove the return or the invoice cause in different case, an Invoice could be the important document and in an other case, the return.

In my tablix, I do not show the Bill ID, because I don't need the information except when there is this "duplication".

I would also like after the flag (line highlited), that on the top of my report, a sentence shows something like : "Those documents are in conflict : 000123123". So with this information showing my ID, I can now go in my multiple values parameter and remove this number.

I wanna achieve those 2 flags because I'm making a calcul from my documents amount and if those 2 would be there, it would make my calcul wrong.

I hope you guys can help me. If so, thank you very much in advance!

I worked on a couple of different expressions but never got the result I wanted. Use previous statement and equals but couldn't find how to make it look like is equals to Invoice and Return and SopNumber equals the same.

select CASE SOP10200.SOPTYPE
                WHEN 1 THEN 'QUOTE'
                WHEN 2 THEN 'ORDER'
                WHEN 3 THEN 'INVOICE'
                WHEN 4 THEN 'RETURN'
                WHEN 5 THEN 'BACK ORDER'
                WHEN 6 THEN 'FULLFILLMENT ORDER'
                END AS SOPTYPE,
                sop10200.SLPRSNID,
                sop10200.XTNDPRCE as ExtendedPrice,
                sop10200.SOPNUMBE,
                iv00101.ITMCLSCD as FAMILYCLASS,
                sop10100.DOCDATE

from sop10200
left join iv00101 on sop10200.ITEMNMBR = iv00101.ITEMNMBR
left join sop10100 on sop10200.SOPNUMBE = sop10100.SOPNUMBE

WHERE SOP10100.DOCDATE BETWEEN '2018-01-01 00:00:00.000' AND '2035-01-01 00:00:00.000' 
union all

select  CASE SOP30300.SOPTYPE
                WHEN 1 THEN 'QUOTE'
                WHEN 2 THEN 'ORDER'
                WHEN 3 THEN 'INVOICE'
                WHEN 4 THEN 'RETURN'
                WHEN 5 THEN 'BACK ORDER'
                WHEN 5 THEN 'FULLFILLMENT ORDER'
                END AS SOPTYPE,
                sop30300.SLPRSNID,
                sop30300.XTNDPRCE as ExtendedPrice,
                sop30300.SOPNUMBE,
                iv00101.ITMCLSCD as FAMILYCLASS,
                sop30200.DOCDATE

from sop30300
left join iv00101 on sop30300.ITEMNMBR = iv00101.ITEMNMBR
left join sop30200 on sop30300.SOPNUMBE = sop30200.SOPNUMBE

WHERE SOP30200.DOCDATE BETWEEN '2018-01-01 00:00:00.000' AND '2035-01-01 00:00:00.000'

ORDER BY SOPNUMBE desc

Correct me if I'm wrong, but it sounds like you want a way to see if there is a duplicate record for the report and use that in a calculation?

You could do a subquery to retrieve a count, and if that is more than 1 than you have a duplicate record

EDIT:

SELECT *, (IF 
    (SELECT Count(S1.SOPTYPE) FROM sop10200 S1 WHERE T1.BillID = S1.BillID ) > 1 THEN "Duplicate " ELSE "" END) AS DuplicateCheck
FROM sop10200 T1

The above solution will give you a value you can use on each page to report whether or not that it has a duplicate BillID.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM