When would the ADD function fail to display the form?

Is there a reason when AppSheet would not display a form to add a new record, which previously used to work?

Three apps that run off the same MySQL database. For two of the apps I recently added the LOOP functionality to maintain a many-to-many relationship between Products and Controls. See link: Looping with Actions, which works great.

Recently discovered: the two apps with this loop functionality have stopped allowing new products to be created. Namely the Add button is there, but the form just does not appear.

The Product_Form does appear to allow edits to existing products, just not adds.

Add button visible.

Blank screen displayed:

I suspect is it NOT a database issue, because the 3rd application, without the loop functionality,
allows new products to be added. Also checked all the permissions to allow adds and updates.

Hence the question: what would trigger this behaviour from AppSheet? :thinking:

This is a bug. I would encourage you to contact support@appsheet.com to report it.

In my experience, the bug is triggered by a different bug triggered by an expression in one of the columns of the row being added. We have to find and fix that expression.

To find the problem expression, remove all App formula, Editable?, Initial value, Suggested values, and Valid If expressions from the all configurations of the non-virtual columns of the table to which you’re adding a row. Test and confirm the problem does not occur with all expressions removed. Then add back one of the removed expressions. Test again. Repeat until the problem recurs, thereby identifying the problem expression. Remove the problem expression. Continue adding back the remaining removed expressions until you’ve identified and excluded all problem expressions and restored all working expressions.

Let us know what the problem expressions are so we can help troubleshoot further.

1 Like

Hi @Steve

Found the culprit expression straight away. The Controls field (non-virtual) which is a list of Refs to the Control table, is used to identify controls that should be applied to this product based the Product’s features. There was a check at the start to cover the scenario when this is a new product and hence does not yet have a definition *[ProductDefinitionUUID]*outlining the features, negating the need to run the query. Appears this was the problem, this test was failing. Original expression is given below.

NB: The InheritedControls is a view/slice on Control table (filtering for feature based controls) as part of maintaining this many-to-many relationship between Product and Control

IFS( ISNOTBLANK( [_THISROW].[ProductDefinitionUUID] ),
InheritedControls[ControlUUID]
)

  • IFS( ISNOTBLANK( [_THISROW].[ProductDefinitionUUID] ),
    Select( InheritedControls[ControlUUID],
    AND( ISNOTBLANK( [Pattern] ),
    NOT( STARTSWITH( [_THISROW].[ProductDefinitionUUID].[TaxonomyCode], [Pattern]))),
    FALSE)
    )

  • IFS ( ISNOTBLANK( [_THISROW].[ProductDefinitionUUID] ),
    Select( InheritedControls[ControlUUID],
    AND( ISNOTBLANK( [IncludeFeatures] ),
    [IncludeAnyAll] = “All” ,
    ISNOTBLANK( [IncludeFeatures] - [_THISROW].[ProductDefinitionUUID].[ProductFeatures] ), [IncludeAnyAll] = “All” ),
    FALSE)
    )

  • IFS ( ISNOTBLANK( [_THISROW].[ProductDefinitionUUID] ),
    Select( InheritedControls[ControlUUID],
    AND( ISNOTBLANK( [IncludeFeatures] ),
    [IncludeAnyAll] = “Any” ,
    COUNT( ( [IncludeFeatures] - [_THISROW].[ProductDefinitionUUID].[ProductFeatures])) = COUNT( [IncludeFeatures] )),
    FALSE)

)

Wrapping it in and IF statement instead, has resolved the issued of adding new product records.

IF( ISNOTBLANK( [ProductDefinitionUUID] ),
InheritedControls[ControlUUID]

  • IFS( ISNOTBLANK( [_THISROW].[ProductDefinitionUUID] ),
    "
    "
    ), LIST()
    )

Hope this is helpful. :thinking:

1 Like

Yep, that looks very similar to many of the problems I’ve had. :slight_smile: