Attachment Template Expression

Hey guys, I hope you are having a wonderful day / night. Unfortunately I’ve been having some trouble on an expression in my Attachment Template. I know this formula works inside of a virtual column, but when trying to use it in the attachment template I’ve ran into some trouble.

It’s a Select expression, and in the Virtual Column it looks like so…
SUM(SELECT(s0[KG],AND([_THISROW].[Paper Type]=[Paper Type],[Category] = “RECEIVE”))) - SUM(SELECT(s0[KG],AND([_THISROW].[Paper Type]=[Paper Type],[Category] = “SEND”)))`

Basically, it’s a product stock control formula that totals the received for a given paper product, and minuses it from the sent to give a ‘current stock’ value inside of a virtual column to give a numerical value (in Kilograms).

Now this is the difficult part… when trying to create the same result in an attachment template I’m running into issues. I’ve tried different variations of ‘filter’ and ‘select’, and while I have experience in listing items on an attachment template, I don’t know how to work in a Filter AND SUM option concurrently to aggregate the data in these rows like I did in the original formula listed above.

Here’s the formula I tried: <<Start:SUM(FILTER(“s0”, [Category] = RECEIVE))>> <<KG>> <<End>>

No luck though, as this is the error I get. I have little experience in using REF columns so I can’t really figure out where I’m going wrong and what I need to change.

I’d really appreciate the help guys, as I know this will be a very useful thing to know going forward when it comes to making reports inside of attachment templates.

Kind Regards,
D

Others are much better at expressions than I am. Hopefully, one of them will respond.

I am not sure why your expression begins with a Start expression. In a workflow template, you use a Start expression to format a set of rows. The value following Start should return the key values of the rows you want to format.

Have you tried simply placing your existing expression between << and >> in the workflow template?
We use the same expression system everywhere including workflow.

You may run into issues because the “current” record in the workflow template may not be the same as in your app, but the expression syntax is the same.

3 Likes

It works Phil. Wow I just want to say thank you so much, you’ve really done a great thing for me Today. I didn’t actually realize you could use formulas like this straight into attachment templates.

1 Like