How to make a column a "ref" to another table and allow multiple choices selected

I have one table referencing another (customer table). i want my user to be able to choose mutiple customers.

This is a list of my users and the customers they are allowed to view.

Wouldn’t making the col a ENUMLIST type with base type REF work?

1 Like

I thought so - but I couldn’t see where to make the base type - Ref?

Correction - I was able to do this, but it doesnt allow the list to be an option. meaning it only allows me to “add” new choices. But not choose any from a list.

1 Like

Yours does not look like this?

Yes. However when i do this nothing from the customer table shows up?

I sometimes wonder how dropdown lists are controlled myself. When setting REF doesn’t work I set VALID-IF or SUGGESTED VALUES expressions. This works everytime.

2 Likes

https://www.appsheet.com/templates/App-that-shows-an-EnumList-of-references-to-another-table?appGuidString=03522600-42f0-4015-a3b4-7da61f13a9d5

In this example, the author sets a VALID-IF expression.

2 Likes

Worked perfectly.

Thanks

1 Like

I spoke too soon. It gives me this error?

FIXED - I had to choose the “key” to the table.

Thanks again.

Sorry last question:

How Do I make the new table bring the [Customer Number] with the corresponding [Customer Name] I just referenced?

you can use an expression..

LOOKUP([Customer Number], “customer table”, “customer number”, “customer name”)

This looks for the value [Customer Number] in “customer number” col of the table “customer table” and returns the value of “customer name” col of the matched row.

https://help.appsheet.com/en/articles/2357309-lookup

Does this answer your question?

2 Likes

@Tiger1 how did you solve this? I still get the empty list.

I did what @TeeSee1 suggested. I used Type - “Enumlist”. Then Reference to my table.

1 Like

yea i got that far. I was missing the Valif If = table[ID]

Oh. I am sorry. Yes my valid if is this:

Is it working for you now?

1 Like

@Tiger1 and @TeeSee1 The only thing missing is that whatever client i select from the multiple selection, do not get an automatic REF_ROWS virtual list like it usually creates when referencing to another table. Did you get to do that? If yes, how did you do it?

my table I reference DID get that “Ref_Row”

Tiger1_0-1663103764102.png

The table you are referencing doesn’t?

No, it does not. I’m basically selecting multiple customers in another
table call projects. Whatever customer i select in the multiple selection
should get a reference to that project in their row. But it’s not working.
It would be good to note that I’m REF to a slice to of table.

I thought you had to ref to another table. @TeeSee1 - any thoughts?

Ref_Rows only works between tables with a relation in the following way

Referenced Table A: Key A

Referencing Table B: Column of type Ref back to A (not of type EnumList)

@casitasrd you need to have a column in your customers table that looks something like below

SELECT (
 projects[project id],
 IN (
  [_THISROW],
  [customers]
 )
)

where [customers] is the field in table projects, of type ENUMLIST, referencing customers table, . This will give you a list of projects that a selected customer is associated with.

2 Likes