Ongoing Templating headaches First simple que...

(Keith Winston) #1

Ongoing Templating headaches First simple question: why wouldn’t this limit printing to the first 3 rows:

<<Start:Top(OrderBy([Related Violations by BlitzKey], [Property]), 3)>>

The associated Report DOES work, but it prints out the entire set. So the Top() doesn’t seem to be working. Any ideas? Thanks.

(Aleksi Alkio) #2

You need to use SELECT with the ORDERBY

(Keith Winston) #3

Argh! Thanks!

(Aleksi Alkio) #4

Would you please share that template with so I can see that one also, thanks

(Aleksi Alkio) #5

I added your formula into a virtual column and it’s filtering correctly. I used this… Top(OrderBy([Related Violations by BlitzKey],[Property]),3).

Though… the OrderBy expression doesn’t have any meaning because your [Property] value is always the same (Address). Also. you have only one record which has 3 Violations so in generally you should see less than 3 related records on your template. Without seeing the template it’s little bit difficult to say more than this.

(Keith Winston) #6

ooohhhh… I think you’re telling me I misunderstood what I was doing. You’re saying that it’s going to limit to the top 3 addresses for each property? I was trying to limit total output to 3, so I could troubleshoot without spinning off 100 emails each time. I deleted a bunch of my data to slightly improve the situation…

(Keith Winston) #7

As I think about it, I probably need to insert a condition in the Report itself to limit the total output. Anyway, I’ll be hammering at this today. Probably lots more questions to come.

(Aleksi Alkio) #8

What you mean by “Limit total output to 3”? What do you want to limit? Your Formula will give you max 3 Key values which are sorted by street addresses.

(Keith Winston) #9

Like I said: every time I run it right now, it spits out as many emails as there are records. It limits each email to no more than 3 violations for that address, I think. So lets say I have 20 addresses with 0-5 violations, I get 20 emails. I only wanted 3 while I’m testing things out.

(Aleksi Alkio) #10

You don’t have any rules in your condition field (Report). That’s why it’s sending all 20 records you have. The START expression is only working inside the template, not as a condition rule.

(Keith Winston) #11

yep. Thanks.

(Keith Winston) #12

But… this is from the documentation: <<Start:TOP(OrderBy([Related Orders [Customer Name]], [Order Date]), 3)>>

(Keith Winston) #13

which is what I was working from

(Aleksi Alkio) #14

My mistake… I messed with TOP and SELECT, sorry.

(Aleksi Alkio) #15

What is the result first without TOP expression?

(Keith Winston) #16

If this is wrong you need to update Start Expressions in Embedded Templates Start Expressions in Embedded Templates

(Keith Winston) #17

As far as I can see, Top doesn’t do anything: I get the entire data set in both cases. I wonder if it has to do with the dereferencing, that it gets confused about what level it’s sorting/topping or something? idk

(Aleksi Alkio) #18

What is the app name and account ID? I will take a quick check if that’s okay for you?

(Keith Winston) #19

Sure, thanks. The name is BlitzFieldModule20180702-437769 you will see that the attachment is mostly commented out while I debug one step at a time (I’m step one, approximately).