Oh sorry, I’m pretty new to using this forum so I didn’t even realised that the post was actually viewed by people
I’ll just write the scenario that required me to link the Memo and the solutions for it below. The trials and error was too much and too long and I rather not remember my poor eyes dying from squinting at codes and trying to figure out the error that doesn’t even comes out as one.
Just a summary, this problem started due to user wanting to track the Purchase Order version as they do make last minutes changes to it. I’m not sure if there are any Modules that tracks document but they do not have any so we use a workaround where the Memo is used to track the version and user will manually add a new memo for a new version of a PO.
Note: I’m doing this for poform report by standard epicor and basically customizing it to add an additional table and field, not by BAQ report. You will probably need to adapt it if you want to use for other data definition.
Issue Faced 1: PO is not link to Memo table. The Data Definition linked tables doesn’t have it as well.
Solution: Manually linking the tables.
Note: To not disturb standard, I usually make a copy of the data definition and the report style that I am going to customize.
Step 1:
In the data definition for the poform, Add new Table and then add the Memo table.
Step 2:
Enter the Memo table, and uncheck the Exclude Column out the following fields. Description on why is written below. The bolded fields are the mandatory ones that I needed.
Company - Required for linking later in the Data Def
CategoryID - Optional for filtering later in SSRS if you use Memo in
Key1 - The linkage that holds the PONum in the Memo table. Note that this is a nvchar field so you will get an error if you try to link using Data Def Relationship
MemoDate - Optional for if you want to pull data out
MemoText - Optional for if you want to pull data out
MemoDesc - This is the Memo Title that will be seen in the report (Version 1, etc, etc…)
Step 3:
Next, after excluding the columns. I create a New Relation.
Below is the Details of the Relation.
And this is the field that I connected in the Relation.
Note: Yes, there’s only 1 field.
There is an additional field to connect, which is the POHeader.PONum field = Memo.Key1 field. This will need to be done in the SSRS template because of the different types of field as PONum is an int type and Key1 is nvarchar type.
Step 4:
Download and open the poform SSRS template and open it with a report builder.
Open the POHeader query formula.
Add the Joins for the Memo table below. The table is T5 for mine.
LEFT OUTER JOIN Memo_" + Parameters!TableGuid.Value + " T5
ON T1.Company = T5.Company AND T5.RelatedToFile = ‘POHeader’ AND cast(T1.PONum as nvarchar) = T5.Key1
Since, mine is referring to the POHeader in Memo, I have filtered out the RelatedToFile to POHeader. If your using a different one then you would need to check in the Memo for which it is in RelatedToFile.
And FINALLY the linkage to PONUM as you can see I have put a cast at PONum
which wraps the PONum field to become nvarchar instead of int.
I tried casting Key1 to int instead but that was where I got the issue where blank results came back. So, it has to be casted at PONum.
After that, I added T5.MemoDesc, T5.Company AS MemoCompany , T5.MemoText before the FROM POHeader_" query as shown below.
Step 5:
I added the fields in the Dataset Property.
And pull the data to the report with the function Last. This is so that it takes the last version value of that PONum Memo. So if user has created and added 3 memo to indicate 3rd version, it will pull out the latest added when printed as shown below.
Hope this helps.
Warm Regards