Error on a template expression

Hello, I am trying to build a template that loads certain information from a table, this information must be filtered by a period selected from a form and I would also like that I can apply a second filter based on a second condition in another column other than the date.

This is the formula that I am using in my excel template:
<<Start:ORDERBY(SELECT(Diario de Movimientos[ID Transaccion],AND([Fecha]>=[_THISROW].[Desde],[Fecha]<=[_THISROW].[Hasta],[Igreso o Egreso]="Ingreso")),[Fecha],FALSE)>><<[Fecha]>>

Without the third condition where the AND expression is working well, it filters the data according to the date selected in the form, but once I add this third condition in the AND it brings me this error on the monitor:

Error encountered in step with name [New step]: Error: 'New process 3' task 'Reporte Ingresos' Body template. Expression 'ORDERBY(SELECT(Diario de Movimientos[ID Transaccion],AND([Fecha]>=[_THISROW].[Desde],[Fecha]<=[_THISROW].[Hasta],[Igreso o Egreso])),[Fecha],FALSE)' is invalid due to: Condition AND(([Fecha] >= [_THISROW].[Desde]), ([Fecha] <= [_THISROW].[Hasta]), [Igreso o Egreso]) has an invalid structure: subexpressions must be Yes/No conditions. Error: 'New process 3' task 'Reporte Ingresos' Body template. Start expression 'ORDERBY(SELECT(Diario de Movimientos[ID Transaccion],AND([Fecha]>=[_THISROW].[Desde],[Fecha]<=[_THISROW].[Hasta],[Igreso o Egreso])),[Fecha],FALSE)' should generate a List of Ref values. Please verify that it generates a List and that the contents of the List are Ref values. Ref values should come from the 'Key' column of the referenced table. Error: The document body is empty

I leave here some images in case they can be of help…

This is the form to generate the report:

Then there is this automation process with this task:

And this is the template:

And this is how the table is organized where the data that I want to filter in my report is found:

I hope you can help me!

attn @natalie

1 Like

Hi @Inventarios_FOODis , I’m not sure where the issue is coming from without deeper investigation. It is strange that [Igreso o Egreso] = "Ingreso" becomes just [Igreso o Egreso] in the error message, so perhaps it is an issue with the expressions parser. Can you open a ticket by filling out this form, so we can take a look at your app?

2 Likes

I agree with Natalie.

I have had issues where the last subexpression in an AND caused an error (took a long time to isolate). I corrected by simply moving that expression to be the first subexpression.

Try moving ‘[Igreso o Egreso]=“Ingreso”’ to be the first subexpression of the AND() and see if there is any difference.

2 Likes

Thanks, @natalie for your reply… But with @WillowMobileSystems answer the problem was solved!

2 Likes

Thanks a lot, problem solved!

2 Likes

You’re welcome! Order shouldn’t matter. Hopefully someone at AppSheet will look at this and try to fix the issue in the platform code.

@natalie

2 Likes

I hope too

@natalie
@Steve