Issue trying to link project attached documents to their respective project stage.

1 month ago 1

Hello,

I couldn't find immoderate solution to this connected this forum. If determination is one, apologies successful beforehand and could anyone delight nexus it!

I'm trying to query for a circumstantial task fundamentally its stages and if determination are attached selling documents to them, with a nexus to that document. The occupation is that nary substance what I effort I ever get arsenic a effect a permutation of each the papers lines with each the stages, truthful the accusation connected what signifier they are specifically assigned to is lost.

Here's an illustration of a starter mentation of the query:

SELECT T4."DocEntry" AS "Link", T3."DocEntry" AS "Link", T2."NAME" AS "Project Name", T1."UniqueID" AS "UniqueID", T1."StageID" AS "Stage ID", T0."DOCNUM" AS "Doc number", T0."Total" AS "Total" FROM PMG4 T0 INNER JOIN PMG1 T1 ON T1."AbsEntry" = T0."AbsEntry" INNER JOIN OPMG T2 ON T2."AbsEntry" = T1."AbsEntry" LEFT OUTER JOIN OINV T3 ON T3."DocNum" = T0."DOCNUM" LEFT OUTER JOIN OPCH T4 ON T4."DocNum" = T0."DOCNUM" WHERE T2."NAME" Like '[%0]'

I've tried:

- each mode of LEFT, RIGHT, FULL joins,

- switching the positions of the tables (starting from the invoices first), 

- simplifying by dumping acquisition invoice and OPMG altogether and focusing connected stageID alone

- utilizing StageID arsenic a nexus alternatively of AbsEntry

The papers lines indispensable beryllium linked successful immoderate mode to the stages specifically and not conscionable mostly to the project, due to the fact that erstwhile a signifier is selected the array PMG4 updates to lone those that are attached to that stage. Worth noting that I americium not an adept successful SQL, conscionable a idiosyncratic of SBO. Any guidance is appreciated.

Read Entire Article