Customer Purchase History Reporting

Let me test it see if it works. I am just going to enter some static stuff first.

1 Like

Here is what I am working on atm. Its not tested yet and not complete but you might get the idea.

[{ENTITY NAME} Purchase History:2,1, 1, 1, 1]
@{ENTITY NAME}
@{REPORT ENTITY DETAILS:E.Id:(EN={ENTITY NAME})}

>>Customer: $1|ID: $2|{SETTING:PHDateBEG}|{SETTING:PHDateEND}|

>Item|Portion| Qty| Price| Total

{REPORT ORDER DETAILS:O.MenuItemName,O.PortionName,O.Quantity.sum,O.Price.sum,O.TotalPrice:(TEN.Customer=$1) AND (TS.Status=Paid) AND O.CreatedDateTime >= {SETTING:PHDateBEG} AND O.CreatedDateTime < {SETTING:PHDateEND}}

{ENTITY NAME} is just placeholder atm while I figure out how to interact with the widget.

Few issues is the structure of Date the colons in the expression.

HMM Perhaps I have my syntax wrong…

Problem lies in the REPORT ORDER DETAILS tag… I am going to work on it more…

Ok updated semi working code:

[{ENTITY NAME} Purchase History:2,1, 1, 1, 1,1]

@{ENTITY NAME}

@{REPORT ENTITY DETAILS:E.Id:(EN={ENTITY NAME})}

>>Customer: B11|ID: B11|{SETTING:PHDateBEG}|{SETTING:PHDateEND}|

>Item|Portion| Qty| Price| Total

{REPORT ORDER DETAILS:O.MenuItemName,O.PortionName,O.Quantity.sum,O.Price.sum,O.TotalPrice:(TENC.Tables=$1)}
1 Like

OK weird. I have been playing with Report Preview and its worked fine but now all of a sudden it wont recognize a parameter.

Take a look at first parameter:

Take a look if I hardcode the 11:

It was working fine just a moment ago. The parameter is clearly working inside the first line but after that it drops off.

@emre any idea?

Report Preview sometimes un-caches values like $parameters, so you might need to use the actual Entity Screen to re-populate the parameter.

1 Like

Hmm report viewer not showing it either. Look at it though it is using the Parameter just fine in first line. By Customer:

THen it forgets it for the actual report tag.

Report Viewer does not know the value of the $parameter either. You need to feed it the value via the Refresh Custom Report Action on the Entity Screen.

1 Like

Ok ill try that makes it somewhat harder to test. Ill hardcode values for now and then try parameters in widget.

Yes, I agree, for sure. Use hard-coded values until the Report works, then make it all dynamic afterward.

This is working now just need to figure out how to feed parameters from the other widgets.

[{ENTITY NAME} Purchase History:2,1, 1, 1, 1]

@John Doe

@{REPORT ENTITY DETAILS:E.Id:(EN=$1)}

>>Customer: B11|ID: |{SETTING:PHDateBEG}|{SETTING:PHDateEND}|

>Item|Portion| Qty| Price| Total

{REPORT ORDER DETAILS:O.MenuItemName,O.PortionName,O.Quantity.sum,O.Price.sum,O.TotalPrice:(TENC.Customer=$1)}

>>||||{REPORT ORDER DETAILS:O.TotalPrice.sum:(TENC.Customer=$1)}

Might add I have not tested Date Filter yet. So to do list is to test Date Filter expression and how to feed parameters from widgets. This is our raw starting point though.

LOL, follow the Tutorial. It’s fairly easy actually. :wink:

I know that what I meant is in the format so REPORT TAGS syntax works its slightly different than SQL. Its more of me thinking out loud. What I meant to say is I need to specify the right parameters in the right format.

Ok, I understand what you’re saying. But I suspect the Refresh Custom Report Action will handle it just fine.

2 Likes

@Jesse try not using @parameterlist format. When you send parameters through widget it will update $1’s and that will break nesting template as both uses $x syntax.

Yep got it. Ill post it all in sec.

1 Like
[$1 Purchase History:2,1, 1, 1, 1]

>>Customer: $2|ID: $5|$3|$4|

>Item|Portion| Qty| Price| Total

{REPORT ORDER DETAILS:O.MenuItemName,O.PortionName,O.Quantity.sum,O.Price.sum,O.TotalPrice:(TENC.Customer=$2)}

>>||||{REPORT ORDER DETAILS:O.TotalPrice.sum:(TENC.Customer=$2)}
2 Likes

Yeah I was thinking too deep and ignoring the action. I was trying to build the report without the action. Thanks to @QMcKay he jolted my brain and snapped me back into reality of what we were working with lol. It was actually quite simple.

1 Like