Setting Initial Value in Nested Form for a Ref

Basically, I have this problem in multiple scenarios when there are 2 Tables.

The first one have a ref column, and when adding a new record to that ref table from the form of table 1, I want to set initial values for the ref column form based on other values of table 1.

Is there any solution for this?

Thanks in advance.

0 17 407
17 REPLIES 17

Based on your description, it seems like you want to set initial values for a ref column in Table 1 based on other values of Table 1 when adding a new record to the ref table.
Try to do this:

  1. Create a new action in Table 1 that sets the initial values for the ref column based on other values of Table 1.
  2. In the Form view of Table 1, add this action as an event action for the โ€œForm Savedโ€ event.
  3. When adding a new record to the ref table from the form of Table 1, the initial values for the ref column will be set based on other values of Table 1.

I hope this helps!

Some Reference:
Ref selection using another column instead of the label 
Drop-down on a Ref column 

Thanks, but it is not what I'm looking.

I'm trying to get a value from Table 1 and set it as initial value in a new record of Table 2 form.

Table 1

value_1
value_2
ref_1 (Table 2 -> creating new entry)

Table 2

value_a
value_b (based on value 1)

 

Hey man,,

inital value = [ref_1].[value1]

Cheers

Yes, there is a solution. This actually is automatically built in if you do the 'ADD' button from the 'Inline' view. Otherwise, if using a custom action to open the child form you should use LINKTOFORM() and follow the guidance here https://support.google.com/appsheet/answer/10106538?hl=en to set your Ref value.

Thanks I have used that in the past. But I'm looking for something exactly like that, but for the case when the child form is opened from the parent form.

 

angeltba_0-1704309630642.png

 

See my other response below. I think you need to make sure that 'Is Part Of' is checked in the REF column settings.

Are you referring to filtering lists as shown in the image?

Appsheet Expression select value from dropdown list.gif

and this one if you need fill some value as initial 

Appsheet Expression select value from dropdown list.gif

โ€ƒ

 

Yes, there creating a new Item, and set initial value for some field in the Item form, based on the main form.

In this case you have a Purchase Form, from there I want to create a new Item.
And in the Item form prefill some values based on the Purchase Form

Just thought of something on this. In Table2 I assume you have a REF column to Table1? Did you check the 'Is Part Of' check box in that column setting? That allows you to fill out the form for Table1 while also adding items to Table2 in the same form interface.

Mmm, in Table 1 I have a ref to Table 2.

In the above example: In Purchase From I have a ref to Item, and in Item just the 'Related List'

What are you thinking on?

I think it would be helpful to know a little more about your table setup. Table1 is your purchase form? So does it have order number, customer info, and the like? Then is your REF column in Table1 an actual column vs virtual column and is of type EnumList with subtype of REF?

Table 1 have a regular ref, no enum, to table 2. In table 1 the ref is an actual column not a virtual one.


Table 1
value_1 (text)
value_2 (text)
....
value_3 (Ref to table 2)

Table 2
value_a (text) [I want to fill this based on value_1 as example]
value_b (text)
....

But it is a subform, so I open Table 1 form, and there I open Table 2 Form from ref field

Even under this condition the relationship should be automatically handled. A screenshot of Table1 form that shows the field/column where you select the Table2 value would still be helpful though.

The relationship is handled. 

But I want to pass a value, how would I?

Ok, think on this. I have a PO Id (text) field in Form 1, and want to pass it to Form 2

Table 1

angeltba_1-1704735662599.png

angeltba_0-1704735599128.png

Then click on new to create a new Record in the ref table, and pass the value to that second form


The problem is that in Table 2 there's no record to reference Table 1 and so to get values from there, except from Related List, because it is a One to Many relationship

Come to think of this just a little bit more, I am thinking you have the REF column in the wrong table to gain the functionality you are looking for. The way you are describing this sounds that you do not have a 'true' nested form, but a column where you can choose an existing value from Table 2 or add a new entry in Table 2. Your app sounds similar to maybe a restaurant ordering app where your order needs to have multiple items added to it? If that is the case I might suggest looking at this sample app https://www.appsheet.com/templates/How-to-add-items-to-an-order-in-an-alternative-way?appGuidString=...

Hey man,

check this out, maybe that's what you're looking for:
https://www.appsheet.com/Template/AppDef?appName=TestApp-145936-23-12-19&utm_source=share_app_link

Cheers

Whoa, I didn't know that was possible, cool feature

It doesn't work for my use case, but definitely will be useful for other stuff.

Top Labels in this Space