Hi everyone, this is my first APP using Appsheet, so I appreciate your help with a problem I have.
Part of my App is an invoice with its detail, I have two tables, one of Invoice and the other Invoice_Detail. The two tables are linked to the ID_Invoice column. The invoice can have two states (valid, voided), I control the change of state with an Action and it works correctly.
In the UX section when I save an invoice, it takes me to the detail view and shows me at the bottom an inline form of the invoice detail with the buttons to view and to add new lines.
What I need is that if the status of an invoice is Voided, that the add line button does not show. To do that, in the Add action of the Invoice_Detail I wrote this condition:
Thanks for checking, I would be curious as to what would happen if you use <> “voided”, would like to isolate the issue to whether or not it’s the lookup or the equality check that’s problematic
Hm then I’m not so sure. One thing to try is to create a virtual column on invoice_detail that evalulates to LOOKUP([_THISROW].[ID_Invoice],“INVOICE”,“ID_Invoice”,“Status”) and see what that output looks like and make sure it matches your expectations
IF in your Invoice_Detail table, the column ID_Invoice is a Ref column, i.e. a pointer back to the Parent Invoice row, (by the way, if it’s not…it should be) then you can take advantage of “dot” notation to retrieve the status and simplify the expression like this:
[ID_Invoice].[Status] <> "valid"
It seems you have ID_Invoice as a column in both tables? LOOKUP() is expanded into an ANY(SELECT()) combination of functions. I suspect that resulting expression is then experiencing some ambiguity with same column names and not finding the correct value.
The expression above is simpler anyway.
As a side note, I found a few places where when column names are the same across related tables you run into these ambiguity problems - templates are another one of those areas. I would recommend refraining from using the same column name in these cases.
I checked the test expresion button with data population and expression results is correct, “Voided” status is FALSE and “Valid” Satus is TRUE, but the button does not show.
[Expressions: New option for faster and more consistent comparisons](https://community.appsheet.com/t/expressions-new-option-for-faster-and-more-consistent-comparisons/51773) Announcements
Hey everyone! In the coming days, we will enable the option for expressions in apps to use new behavior for comparison operators (=, <>, <, <=, >, >=). This will be an improvement in sync performance and consistency of results. The current behavior will be called the Legacy option and the new behavior will be called the Consistent option. The ability to change an app between Legacy and Consistent will be added under Data > Options > Expressions > Blank value comparison mode. [image] Performa…
I tested Legacy and Consistent option in this case and the behavior is the same.
The data in tables (INVOICE, INVOICE_DETAIL) are very simple, only 2 rows each one, and no BLANK data exist.
Following your suggestion in one of your posts I changed the expression using IN instead of =. I checked the Expression Test window and it evaluates the condition correctly, but in the App it doesn’t.
Create a slice of the INVOICE_DETAIL table with no Row filter condition expression, and with Update mode set to Read-Only .> 1. Add a virtual column to the INVOICES table called Viewable INVOICE_DETAILs and an App formula expression of:> > auto> [Related INVOICE_DETAILs]> > > > 1. For the Viewable INVOICE_DETAILs column, set Show? to the expression:> > auto> [INVOICE_ID].[Status] = "voided"> > > > 1. For the Related INVOICE_DETAILs column, set Show? to the expression:> > auto> [INVOICE_ID].[Status] = "valid"> >
Maybe this will help.
Step #5. Set the new VC’s “Referenced table name” to point to the new Slice.