Data: add a new row to another table using values from this row, action related

I want to record the column in the table using the formula I wrote below. but when I register normally, the value from the inital value does not come with the action, which is automatic, what’s the problem?

IFS(
AND([ID].[Name]=“A”, CONTAINS([ID].[Feature], “ab”)), “10”,
AND([ID].[Name]=“A”, CONTAINS([ID].[Feature], “xy”)), “2”,
AND([ID].[Name]=“B”, CONTAINS([ID].[Feature], “ab”)), “10”,
AND([ID].[Name]]=“B”, CONTAINS([ID].[Feature], “xy”)), “1”,
[ID].[Name]=“C”, “10”
)

@Pointer
Can you please elaborate your problem?

1 Like

No problem when I use the formula “initial value” in the related column in the related table that is being recorded, but when I try to do it over another related table using action (using the formula below), no automatic data is coming.

IFS(
AND([ID].[Name]=“A”, CONTAINS([ID].[Feature], “ab”)), “10”,
AND([ID].[Name]=“A”, CONTAINS([ID].[Feature], “xy”)), “2”,
AND([ID].[Name]=“B”, CONTAINS([ID].[Feature], “ab”)), “10”,
AND([ID].[Name]]=“B”, CONTAINS([ID].[Feature], “xy”)), “1”,
[ID].[Name]=“C”, “10”
)

So you are trying to invoke a Form View via an action button in the detail view and your set initial value is not working? Is that the problem?

1 Like

There is no problem when I make a record on the related table, when I add a record from the main table with action, the initial value does not come.

@Pointer
What kinda expression are you using with your action? Can you copy it here pls? Thnx.

action name: Data: add a new row to another table using values from this row

Related column formula:IFS(
AND([ID].[Name]=“A”, CONTAINS([ID].[Feature], “ab”)), “10”,
AND([ID].[Name]=“A”, CONTAINS([ID].[Feature], “xy”)), “2”,
AND([ID].[Name]=“B”, CONTAINS([ID].[Feature], “ab”)), “10”,
AND([ID].[Name]]=“B”, CONTAINS([ID].[Feature], “xy”)), “1”,
[ID].[Name]=“C”, “10”
)

this table does not come with a conditional expression initial value, even though the initial value is returned to the normal table. conditional expression not available? because when I add a record directly to the table, the initial value comes. no error in formula screen

@Pointer
You are using a de-ref in your expression. Does the other table that you are trying to add a new row have the same reference with the mother table of the source/child table?

@LeventK
Yes there is. no problem when I entry via normal table, the data I want comes as the auto initial value

@Pointer
I believe we are either not in the same page or I may expressing myself incorrectly. Can you share your app with me as a co-author? I can take a look. You can share with levent@able3ventures.com

My application is very complicated, Data: add a new row to another table
Is there a sample formula, how to make conditional record when using?
Can ifs, if or switch formulas be used? made no errors but no results

Firstly, I’m an AppSheet Developer and Partner for over 4 years now and also having a Partner Development company which had built over 500 AppSheet apps since, I believe I have enough expertise to understand how an app is built regardless how it’s complex or not.

Secondly, I ditto that we’re still not in the same page for your problem. So I’ll try to be more refine and more clear. You have below expression:

IFS(
	AND([ID].[Name]=“A”, CONTAINS([ID].[Feature], “ab”)), “10”,
	AND([ID].[Name]=“A”, CONTAINS([ID].[Feature], “xy”)), “2”,
	AND([ID].[Name]=“B”, CONTAINS([ID].[Feature], “ab”)), “10”,
	AND([ID].[Name]]=“B”, CONTAINS([ID].[Feature], “xy”)), “1”,
	[ID].[Name]=“C”, “10”
)

In this expression, the fragment [ID].[Name] is called a De-Referencing Expression which denotes that in this TableA your [ID] column is a ref type to a certain TableB.

Now you are trying to create a data row with a Behaviour Action in a certain TableC and your source table is (presumably) TableA. After you have written your expression have you tested expression result in the expression builder and expanded the calculation to see which value it returns?

1 Like

@LeventK

thank you so much, no problem when De-Referencing Expression is not used,

@Pointer you’re welcome. And you can re-write or simplify your expression like this:

IFS(
	OR(
		AND(
			OR(
				[NAME]="A",
				[NAME]="B"
			),
			CONTAINS([Feature],"ab")
		),
		[NAME]="C"
	),"10"
	AND([Name]="A", CONTAINS([Feature], "xy")), "2",
	AND([Name]="B", CONTAINS([Feature], "xy")), "1"
)
1 Like

Thank you very much this was great.
Does the application run more slowly when formulas are not simplify?

For sure it might have an effect on the sync time. Besides, an IFS expression shall be constructed wisely as opposed to SWITCH. By-nature, IFS expression stops evaluating the successive conditional statements once any conditional statement evaluates to TRUE. On the opposite, the SWITCH expression evaluates each one of the set conditional statements even though any one them evaluates to TRUE.

1 Like