ENUM list from dropdown selection with multiple dropdowns

I want to generate a multi-selectable list from a table.

The table already contains two columns of drop down data, the second one of which I've loaded as a dependent dropdown and that works.

I need a second dependent dropdown which generates a multi-selectable list, like ENUM list.

Can this be done? It appears not from testing.

I believe there's some kind of solution involving refs but from reading about it, I don't think I understand how to do it.

Thanks for any help

James

Solved Solved
0 28 4,126
4 ACCEPTED SOLUTIONS

Hola JamesWB, creo que esto podrรญa ayudarte a encontrar la soluciรณn a tu menรบ en cascada.

primero estructura tus tablas de tal manera que pueda referenciarse yo la realizar de la siguiente manera:

1.png2.png3.png4.png

luego cree el ejemplo de appsheet con estas tablas:

5.png6.png

y en la tabla result , fila quest y standards, en el campo Suggested values

7.png7_A.png8.png8_A.png

 

este seria el resultado del menu en cascada 

9.png

10.png

11.png

12.png

13.png

14.png

el resto lo podrias concatenar en un solo campo separado por comas como sugieres.

espero que el ejemplo te sirva para tu proyecto saludos. 

View solution in original post

I looked more carefully at your pictures and it's all working now!

Thanks, great to get your help!

You are very clever, or at least, much cleverer than me!

James

View solution in original post

Hola Jaime, disculpa no haber contestado antes hoy he estado ocupado en el trabajo, estaba leyendo la รบltima solicitud y creo entender lo que quieres lograr al final, lo puedes resolver de la siguiente manera

En tu tabla result, columna standards modificarรญas el tipo de dato ya no serรญa un REF ahora pasarรญa a ser un enunList que es lo que deseas para realizar una selecciรณn mรบltiple dentro del menรบ, pero ese enunlist tendrรญa una base Ref que apunta a la tabla standards por ejemplo

1.png

 

ahora tu valor sugerido no serรญa un dato esperado asรญ que la misma fรณrmula, pasarรญa a ser un Valid If de esta manera

2.png

de esta manera en el menรบ podrรกs realizar varias selecciones por ejemplo

Captura de Pantalla 2022-02-17 a la(s) 4.02.25 p. m..png

 

el resultado serรญa de esta manera

en la Vista result

45.png

En la Tabla result

Captura de Pantalla 2022-02-17 a la(s) 4.05.00 p. m..png 

 

creo que eso es lo que necesitas.

 

saludos

 

View solution in original post

serรญa de la siguiente manera,

En el google sheet agregaras una columna a la tabla regulation llamada regtext (asegurate que la columna sea texto sin formato) y a la tabla result una columna que se llamaria r_regtext en el appsheet regeneras tus tablas

1.png

en la tabla regulation la colunma  regtext el tipo de dato debes colocarlo en Text de igual forma en la tabla result columna r_regtext

Captura de Pantalla 2022-02-18 a la(s) 11.27.30 a. m..png

despuรฉs en la tabla result columna r_regtext editas el Initial Value

3.png

el resultado serรญa en appsheet

4.png5.png

en la tabla de de google sheet

6.png

saludos amigo 

 

View solution in original post

28 REPLIES 28

You can create a dropdown list from any column of any table.

 

A field "dd2" of table "T1" is defined like this to get a dropdown in the second pic,

Here the table "dd" has a non-key column named "dd2". (suggested values dd[dd2])

TeeSee1_1-1644988989198.png

And this is what you get

TeeSee1_2-1644989058209.png

 

tables' defs

TeeSee1_3-1644989269280.png

 

 

That's useful thanks, but unfortunately it isn't quite what I need.

In my project, the user selects a value from a dropdown. I then need to use that value to look up the data for the next dropdown from a table. However, when I have two dropdowns looking at the same dependent source, it gets confused and removes one or makes the dropdowns nonsense.

in the suggested values expression, the selection in your first dropdown can be incorporated.

However, you need to show what those two dropdowns are based on and how they are related for us to give you a more concreate suggestion.

Thanks.

I'm not even sure how I should design the data in the sheet to be honest.

I have a table RegulationsandStandards that currently has two columns, Regulation and Question. The dependent dropdown selects from the Regulations column and then loads the relevant Questions in the dropdown. See below.

JamesWB_0-1645015837701.png

I just use the standard ValidIf method to load the dependent.

JamesWB_1-1645015879819.png

When the user selects a Regulation, I want to add a second dropdown, Standards, of type ENUM List, which will therefore be multi-selectable. This has values against the Regulations.

JamesWB_2-1645016236533.png

I want the result to go into a new virtual or real column in the Hazard table as a comma separated list of text values from the Standards column in the sheet called 'Standards List'.

JamesWB_3-1645016343834.png

 

Hola JamesWB, creo que esto podrรญa ayudarte a encontrar la soluciรณn a tu menรบ en cascada.

primero estructura tus tablas de tal manera que pueda referenciarse yo la realizar de la siguiente manera:

1.png2.png3.png4.png

luego cree el ejemplo de appsheet con estas tablas:

5.png6.png

y en la tabla result , fila quest y standards, en el campo Suggested values

7.png7_A.png8.png8_A.png

 

este seria el resultado del menu en cascada 

9.png

10.png

11.png

12.png

13.png

14.png

el resto lo podrias concatenar en un solo campo separado por comas como sugieres.

espero que el ejemplo te sirva para tu proyecto saludos. 

Wow, very complete answer, thank you! I will try it in a test and see if I can make it work. I have problems because my existing solution is complicated and it's easy to disrupt it and then nothing works.

Hi, when I replicated your sheet and then attempted a new Example app, it doesn't create the ref rows. I also tried it without the data in the sheet and it still did not create the refs.

Can you give me the code for the ref columns please? How did you create them, did you let Appsheet create the app for you from the data and then it created the ref rows automatically?

thanks

James

hola Jaime, para que la referencia sea creada en automรกtico al generar tu appsheet, debes crear referenciar las tablas a travรฉs de la ID de cada una, te explico.

1.png

si observas la tabla regulation contiene id_r que apunta a la columna regulation ese es el primer dato

2.png

la tabla quest su id_q apunta a la id_r de la tabla regulation ese seria tu segundo dato

3.png

la id_s apunta a la id_q de la tabla standards y ese seria tu ultimo dato.

Captura de Pantalla 2022-02-16 a la(s) 8.53.53 p. m..png

en tu tabla result cada columna apunta a la id de cada tabla.

al crear tu appsheet, la identifica automรกticamente.

si no la identifica automรกticamente deber hacer la referencia de forma manual, cada columna a cada tabla por ejemplo.

Captura de Pantalla 2022-02-16 a la(s) 8.56.48 p. m..png 

el resto seria como te lo explique anteriormente.

saludos 

I looked more carefully at your pictures and it's all working now!

Thanks, great to get your help!

You are very clever, or at least, much cleverer than me!

James

Hola Jaime, que bueno que te ayude con tu consulta saludos y estamos a la orden.

It's a clever solution, but it creates simple dropdowns only. I need to generate an ENUM list for Standards than can then be multi-selected and the results shown as a comma separated list. It looks to me as if this can't be achieved? Because virtual columns can't be ENUM lists?

How do I make Standards into an Enum List?

Evidently Standards column of Standards needs some formula that derives the data from the options of Standards column in the Standards table that match a certain id_q in your design, although it would be better if they matched the id_r from quest, because both are supposed to be dependent on Regulations and not what you've done which is Regulations>>Questions>>Standards. However, I can list them all as belonging to Questions if I have to.

 

JamesWB_0-1645114529369.png

 

 

 

Hola Jaime, disculpa no haber contestado antes hoy he estado ocupado en el trabajo, estaba leyendo la รบltima solicitud y creo entender lo que quieres lograr al final, lo puedes resolver de la siguiente manera

En tu tabla result, columna standards modificarรญas el tipo de dato ya no serรญa un REF ahora pasarรญa a ser un enunList que es lo que deseas para realizar una selecciรณn mรบltiple dentro del menรบ, pero ese enunlist tendrรญa una base Ref que apunta a la tabla standards por ejemplo

1.png

 

ahora tu valor sugerido no serรญa un dato esperado asรญ que la misma fรณrmula, pasarรญa a ser un Valid If de esta manera

2.png

de esta manera en el menรบ podrรกs realizar varias selecciones por ejemplo

Captura de Pantalla 2022-02-17 a la(s) 4.02.25 p. m..png

 

el resultado serรญa de esta manera

en la Vista result

45.png

En la Tabla result

Captura de Pantalla 2022-02-17 a la(s) 4.05.00 p. m..png 

 

creo que eso es lo que necesitas.

 

saludos

 

Fantastic, that worked perfectly.

Thanks so much again for all your help!

Hi again, sorry, I have one final question!

It now works properly showing the standards as an Enum list.

JamesWB_0-1645182883853.png

I am populating this list using the ValidIf expression:

SELECT(standards[id_s],[_THISROW].[regulation]=[id_r])

When saved to Results, it saves the IDs of the Standards and not the text names. So for example it currently shows 15, 17 in the Results.

JamesWB_1-1645182985797.png

 

When really I want it to show 

Essential Health & Safety Rrequirements - EHSR Annex 2, Machinery Directive 2014/35/EU

as in the Standards table.

JamesWB_2-1645183078778.png

Do I need a virtual column now that looks up the text field for each id_s and then writes them into the Results?

thanks.

Hola Jaime, no te preocupes amigo, lo que pides es facil ya que tienes las ID de las demรกs tablas, solo debes hacer unos cambios en la columna standards de la tabla result.

en tu caso particular ya la Base Type que la debes tener en Ref , se cambiarรญa a Text.

1.png

la fรณrmula de Valid if ya no seleccionarรญa la columna id, si no la columna standards, el resto quedarรญa igual.

vista de la appsheet

2.png

vista del google sheet

3.png

ahora obtendrรกs el texto en la tabla result de la columna standards como deseas.

saludos amigo. 

 

That made it work, thank you. I don't understand what "base type" is, what is a base type in app sheet?

thank you.

James

Esta bien amigo, te explico mas detallado

Captura de Pantalla 2022-02-18 a la(s) 9.21.10 a. m..png

si observas correctamente solo debes cambiar en el select la  [id_s] por [standards], el resto seguirรญa igual. 

saludos

Thank you.

I am having a similar problem with Regulation number.

In the sheet, they are laid out like this:

JamesWB_0-1645194834121.png

I need RegText values to be saved, because id_r has to be sequential but one of the rows has the value "8/9" (not a mathematical expression, just text) and because in real life they start at "4".

How do I load RegText instead of id_r into the results column regulation?

I can't change the Base Type as it is text.

thanks

James

serรญa de la siguiente manera,

En el google sheet agregaras una columna a la tabla regulation llamada regtext (asegurate que la columna sea texto sin formato) y a la tabla result una columna que se llamaria r_regtext en el appsheet regeneras tus tablas

1.png

en la tabla regulation la colunma  regtext el tipo de dato debes colocarlo en Text de igual forma en la tabla result columna r_regtext

Captura de Pantalla 2022-02-18 a la(s) 11.27.30 a. m..png

despuรฉs en la tabla result columna r_regtext editas el Initial Value

3.png

el resultado serรญa en appsheet

4.png5.png

en la tabla de de google sheet

6.png

saludos amigo 

 

Worked! Had to reload the page. Strange how the app continues to cache old field names sometimes.

Thanks so much for all your help during the last two days, I much appreciate it.

James

 

Hi, I have a new problem. (sigh)

I need to deploy this solution in the form for the table Hazards, the form is like this:

JamesWB_0-1645449301629.png

and the table Hazards, where I need to save the results for Regulations, Questions and Standards, currently looks like this:

JamesWB_1-1645449362755.png

I assume I will need another column to store the Standards.

At the moment, the expression:

SELECT(quest[id_q],[_THISROW].[regulation]=[id_r])

doesn't work for the Questions field in the Hazards form. I assume the code must be more complicated. I want to select a dependent dropdown list from Regulations using id_r from Quest and then load the result into a column in Hazards. But I assume that the _THISROW bit is here attempting to reference Hazards?

How do I call these values in from the quest and standards tables in this context please?

thanks!

James

Hola James, primero que nada te recomiendo que consideres trabajar con tablas relacionadas como te he mostrado anteriormente, de esa manera se te serรก mรกs fรกcil poder acceder a informaciรณn de otras tablas.

respecto a tu pregunta se me ocurre realizarla de manera parecida a lo expuesto en los menรบs desplegables.

1.png

la tabla Hazards deberรญa tener referencia a las tablas regulation, quest, etc. 

2.png

porque a la hora de crear tu appsheet ella en automรกtico se va referenciar como se muestra en la imagen.

3.png

tu columna id_r al ser una referencia te traerรก las ids de esa tabla, como ya sabes eso lo va a desplegar en un menรบ (aquรญ no necesitas agregar mas nada).

4.png

como necesitas la descripciรณn que contiene regulation y como ya tienes la id solo seria cuestion de solicitarla a tras de la id_r que obtuviste en la primera columna de la siguiente manera

5.png

ahora para obtener el dato de id_q (recuerda que este dato es un ref), utilizaremos id_r ya que estรกn relacionados

6.png  

lo obtendremos de la siguiente manera 

7.png

y el contenido de quest se obtiene mediante este dato(id_q) de esta manera

8.png 

9.png

los resultado serian:

en Appsheet

10.png11.png

en google sheet

12.png

los datos regulation y quest en el formulario puedes ocultarlos.

saludos 

Thank you for your help as always.

It didn't work. It loads the fields in the form and Regulations pulldown works but just an empty text box for Questions.

JamesWB_0-1645526282749.png

For Questions, I have it as follows:

JamesWB_1-1645526319999.pngJamesWB_2-1645526330352.png

For Hazards, I now have:

JamesWB_3-1645526359574.png

For id_q in Hazards I now have:

JamesWB_4-1645526427302.png

 

JamesWB_5-1645526439803.png

Have I missed something in id_q? Or is the problem something else?

thanks

James

hola, por lo que me muestras veo que en tu formulario estรกs tratando de adquirir primero el contenido de Regulation y quest

a1.png

pero Regulation y quest son dependientes de id_r,  id_q

Regulation y quest serรญa un dato no editable y su fรณrmula debe estar colocada en Initial value  para que al colocar la id ( en id_r y id_q) ella busque el dato.

te dejo el ejemplo

grabacion.gif

saludos, ya me siento parte de tu proyecto ๐Ÿ˜

Ha, you are part of the project!

I don't understand, sorry.

If I put the formula:

SELECT(quest[id_q],[_THISROW].[id_r]=[id_r])

in the Initial Value for id_q, there is an error - unexpected Type for Ref.

In your example above, you showed the formula in Suggested Values?

What do I put in Initial Value please?

te dejo capturas de como estรกn configuradas cada columna

esta es toda la tabla

1.png

 

te voy a mostrar las que te interesan paso a paso

la primera es id_r

2a.png2b.png

regulation

3a.png3b.png

id_q

4a.png4b.png4c.png

quest

5a.png5b.png

ahora bien insisto que el problema estรก en el orden que capturan los datos en tu formulario Hazard

saludos

Thanks.

Everything relevant in my form is the same as in your examples above. But it doesn't work, it just creates an empty box for Questions in the form.

Is there a way to show you my app?

EDIT

Actually a difference between mine and yours was that I had Hazard:Regulations pointing to table Regulations and if I remove that and just have the Initial Value SELECT statement, it displays nothing at all in the form field, just an empty box.

 

EDIT

If I make id_r and id_q editable, they work correctly!

JamesWB_0-1645551053109.png

So the problem is that Questions and Regulations (where I want to store the results in the Hazard table) are not picking up the correct text for each id_q and id_r.

Top Labels in this Space