Template Issue

Drew_D
New Member

Iโ€™ll start by saying that Iโ€™ve looked for an answer on this but I canโ€™t find one or simply donโ€™t know what to search for. I have some reports setup that worked at one point however theyโ€™re no longer sending the information in the template and instead filling the first cell with <templateReference:id=1>

Anyone know what this is? how to fix it?

This is what the template looks like:
3X_3_9_39e1d531167e228b1e8e5e6f6836249c6b2686e0.jpeg

This is the emailed report:
3X_6_5_65ff375fb557407f5660dfc716549c3e92471929.jpeg

1 12 927
12 REPLIES 12

Steve
Platinum 4
Platinum 4

Iโ€™ve seen several community members note this behavior recently. Iโ€™d call this a bug. Please contact support@appsheet.com for help with this. Iโ€™ll also escalate internally.

Hi Drew,
could you share your template?

As for reference on how to use excel templates, here is a public help doc โ€“ Microsoft Excel Email Templates | AppSheet Help Center

Thanks!

Is there an answer to this issue?

I have a similar problem. I think that it is to do with there not being any rows in the table to display, either through the table being empty or the filter/select method not returning any rows to export. Iโ€™m trying to find a workaround that removes it, but havenโ€™t had any luck so far.

Iโ€™ve tried putting an IF() condition on the start statement like this:

<<Start: 
IF(
  COUNT(FILTER("Thing_Table", ([UniqueID] = [_THISROW].[UniqueID])))=0,
  LIST(),
  FILTER("Thing_Table",([UniqueID] = [_THISROW].[UniqueID]))
)>>
<<SELECT(Thing_Table[Thing_name], ([UniqueID] = [_THISROW].[UniqueID]))>>

That didnโ€™t work and returned the error:
Start expression expression should generate a List of Ref values. Please verify that it generates a List and that the contents of the List are Ref values.

I also tried putting the IF() condition on the following expression:

<<Start: FILTER("Thing_Table",([UniqueID] = [_THISROW].[UniqueID]))>>
<<IF(
  SELECT(Thing_Table[Thing_name], ([UniqueID] = [_THISROW].[UniqueID]))="",
  "",
  SELECT(Thing_Table[Thing_name], ([UniqueID] = [_THISROW].[UniqueID]))
)>>

That didnโ€™t work either.

So finally I tried using the <<If: yesno-expression>> method detailed here, all in the first cell like this:

<<If: COUNT(FILTER("Thing_Table", ([UniqueID] = [_THISROW].[UniqueID])))>0>>
<<Start: FILTER("Thing_Table",([UniqueID] = [_THISROW].[UniqueID]))>>
<<SELECT(Thing_Table[Thing_name], ([UniqueID] = [_THISROW].[UniqueID]))>>

*** finishing off in the last cell like this ***

<<[Thingamyjig]>><<End>><<EndIf>>

No luck with that either. I got the following message back from the Monitor:
Expression โ€˜If: COUNT(FILTER(โ€œThing_Tableโ€, ([UniqueID] = [_THISROW].[UniqueID])))>0โ€™ is invalid due to: Unable to find function โ€˜IF: COUNTโ€™, did you mean โ€˜COUNTโ€™?.

I note that the Excel export is not listed for this method in the webpage that I linked above, but I thought that Iโ€™d give it a shot anyway. Look like this it an unresolved issue. If someone knows a way around this problem please let me know.

This is a brief response but yes Iโ€™ve found the issue to be related directly to having no records to display for the table.

The problem here is that the data type of the result of an IF() expression is taken from the then expression. LIST() returns an empty list of (I believe) Text; FILTER(...) returns a list of Ref. But because the then expression is list-of-Text, the else expression result is converted to a list of Text.

<<Start>> wants a list of Ref. A list of Text is an error.

Believe it or not, you should be able to fix this particular problem by simply restructuring your expression:

<<Start: 
IF(
  COUNT(FILTER("Thing_Table", ([UniqueID] = [_THISROW].[UniqueID]))) <> 0,
  FILTER("Thing_Table",([UniqueID] = [_THISROW].[UniqueID])),
  LIST()
)>>

Hi Steve,

Thanks for your advice, I appreciate your reply. The code worked, but the original issue is still there. This is that when the returned number of rows is zero we get a results returned in the first cell that is something like:

<<templateReference:id=7>>

If the <<If: >> statements worked for XLSX export I think that this would be easy to solve.

Itโ€™s not really a problem for me in this instance, but I donโ€™t suppose that you have any other suggestions for how to get around this issue?

Thanks again.

Thatโ€™s clearly a bug. I encourage you to report it to Support.

https://www.appsheet.com/Support/Contact

Right, okay. I tried that, but the support page isnโ€™t working and refers me to the support page that isnโ€™t working. Hmmmm.

I tried yesterday and today. Maybe Iโ€™ll try it again in a few days.

Are you able to provide details of what occurred when trying to open a support case? Was there an error message?

We are also getting this when creating an xls file from template when the lists are empty. This is not the default behaviour when creating a pdf file (then it just empty):

ecitonapplicati_0-1658735318463.png
Was this ever resolved by anyone? 

 

Please contact AppSheet Support for help with this.

Top Labels in this Space