Action: Passing an enum status value from parent to child

Hi.

What it the best way to pass an enum value from a parent record to a child record when building a simple action type: Data: set the values of… ?

I thought this [Opération ID].[Statut] would work since I have the REF to the parent (Opération ID) on the child table but it indicates: Error in expression…

This works but I do not feel it is the best way.
INDEX(SELECT(Opérations[Statut],[Opération ID]=[_THISROW].[Opération ID]),1)

In the Set these columns value expressions:

Bare column expressions refer to the row from which the action is initiated. For instance, if the action is performed from/by the parent row, [Statut] refers to the Statut column value of the parent row. Prefixing the column with [Opération ID]. is unneeded and probably even problematic–unless your intention is to dereference the Opération ID column value of the parent row to get the Statut column value of a different row (which doesn’t appear to be the case here).

I would expect the following expression to be all you need:

[Statut]

Hi @Steve.

Thanks for your input! To give more context, the action is initiated from the child called Affectation (which also has a Statut field :slight_smile:). So as you have explained [Statut] is the value of the current row, the child which is not the value expected.

To be more precise (by using your vocabulary which shows your deep understanding of the product), I am trying to dereference from the child to the parent.

It sounds like I am doing something wrong that prevent this dereference to work.


!

1 Like

The Opération ID colum is of type ‘Text’ instead of ‘Ref’. This is why de-referance fails and the select expression works

2 Likes

Hi @Sid

Thanks for your sharp observation!

Hi @Sid

I have just came across this situation where the table column is set as a text value and the dereference works in the App formula but not in the Initial value. What explain this behaviour?

When the column is set as a REF, it works in both cases.

That’s probably a bug. Whatever the case, if you intend to dereference it, it should be a Ref.

Hi @Steve.

I am sure you have a good intuition for detecting a bug.

Lets pretent that the dereference is a date, text, address… Does it make sense that the receiving column be a REF?

In this expression:

[Evenement ID].[Saison ID]

The Evenement ID column must be of type Ref to function properly everywhere it should. The type of the Saison ID column has no bearing on the dereference of Evenement ID. The type of the Saison ID column should be compatible with that of the column being set (numeric if numeric, temporal if temporal, etc.).

Does that cover what you’re asking?

Hi @Steve

You are absolutely right. Let me bring some clarification on the behaviour I have observed.

When the column to initialize is of TEXT type the dereference in the Initial value does not work. While if it is of REF type the initialization works.

In the scenario below, the field Saison ID is blank while a value is expected. Also, if Saison ID it a TEXT and the same expression is put in the Formula. The value will be as expected. So, it seem the dereference does not produce the same result depending of the receiving value type (TEXT or REF) and whether the Formula or Initial value is used.

Is there a logical explanation to it?

Again…

…in AppSheet itself.

Contact support@appsheet.com for help with this.