Manually add value to dropdown list

Hi

How can I manually add another option to a dropdown list?

I am using the following code to get my options where the user will be able to select 'Gloss' or 'Matt' laminate, but there could also be a third option, None!

 

Select(Laminate[Finish],AND(
    [Service Type]=[_ThisRow].[Service Type],
    [Application Type]=[_ThisRow].[Application Type],
    [Media Type]=[_THISROW].[Media Type],
    [Brand]=[_THISROW].[Brand],
    [Matching Media] = [_THISROW].[Range]
  )
)

The user may not want to have laminate and although the options are there, they may just want to say none.

I've tried using the enum option where you can add options but it won't work with my code.

Is there a way I manually add a 'none' option to my code?

Solved Solved
0 18 326
1 ACCEPTED SOLUTION

Use this:

IF(
  AND(
    ISNOTBLANK([Service Type]), 
    ISNOTBLANK([Application Type]),
    ISNOTBLANK([Media Type]),
    ISNOTBLANK([Brand]),
    ISNOTBLANK([Range])
  ),
  SELECT(Laminate[Finish], AND(
    [Service Type] = [_ThisRow].[Service Type],
    [Application Type] = [_ThisRow].[Application Type],
    [Media Type] = [_ThisRow].[Media Type],
    [Brand] = [_ThisRow].[Brand],
    [Matching Media] = [_ThisRow].[Range]
  )) + LIST("None"),
  LIST("")
)

 

View solution in original post

18 REPLIES 18

Select(Laminate[Finish],AND(
    [Service Type]=[_ThisRow].[Service Type],
    [Application Type]=[_ThisRow].[Application Type],
    [Media Type]=[_THISROW].[Media Type],
    [Brand]=[_THISROW].[Brand],
    [Matching Media] = [_THISROW].[Range]
  )
)+LIST("None")

List Expressions | AppSheet Help Center

List Functions | AppSheet Help Center

List Addition | AppSheet Help Center

LIST() | AppSheet Help Center

Thank you, I thought that was the answer and the code is almost perfect but not quite right.

The 'None' option shows on-load but the 'gloss' add 'matt' only shows when the previous selection has been made. I need None to only show when the other options show. 

Do many people still use Appsheet? 

I would have thought there be more people on here?

 

I’m still stuck on this and I’m now wondering if it’s worth just sticking to learning JavaScript.

I appreciate the link you posted, I've looked through it and I don't get how that can help me, what am I missing?

I understand you're trying to help me work out the answer for myself rather than give it to me on a plate but having searched this website all day, I'm no further forward.

Personally I need to be given working code and then have it broken down line by line to tell me what it does. If there were examples like this, I think I would be further along on my journey.

I’m on my mobile. 

IF( AND(
  ISNOTBLANK([column1 from above]),
  …,
  ISNOTBLANK([column5 from above])
  ),
  paste the code snippet of Oscar,
  “”
)

Thank you. when you get in front of a desktop I would really appreciate it if you could help further. Based on your previous question and don't laugh because I don't understand the code but I came up with two versions, both don't work.

#1 - Tried incorporating your code and the code from the link

IF(Laminate[Finish],AND(
ISNOTBLANK([Service Type]), ([Service Type] = [_THISROW].[Service Type]),
ISNOTBLANK([Service Type]), ([Application Type] = [_THISROW].[Application Type]),
ISNOTBLANK([Service Type]), ([Media Type] = [_THISROW].[Media Type]),
ISNOTBLANK([Brand]), ([Media Type] = [_THISROW].[Brand])
),
Select(Laminate[Finish],AND(
[Service Type]=[_ThisRow].[Service Type],
[Application Type]=[_ThisRow].[Application Type],
[Media Type]=[_THISROW].[Media Type],
[Brand]=[_THISROW].[Brand],
[Matching Media] = [_THISROW].[Range]
)
)+LIST("None")
)

#2 - Tried following your instructions


IF( AND(
ISNOTBLANK([Service Type]),
ISNOTBLANK([Brand])
),
Select(Laminate[Finish],AND(
[Service Type]=[_ThisRow].[Service Type],
[Application Type]=[_ThisRow].[Application Type],
[Media Type]=[_THISROW].[Media Type],
[Brand]=[_THISROW].[Brand],
[Matching Media] = [_THISROW].[Range]
)
)+LIST("None")
)

#2

You forgot the line with “”

Also a coma , at the end of the line before. 

You should spend some time learning how expressions work, incomparably less than “learning js”, otherwise you’ll keep running into problems and you’ll waste more time in vain. 

https://help.appsheet.com/en/articles/919759-expressions-the-essentials

I'll certainly be reading everything I can about Appsheet to help me learn and understand it.

I think I've edited your code correctly but I get this error.

Screenshot 2022-03-13 at 00.16.26.png

Replace the three dots … in the beginning by the rest of your columns, one line each, similar to service type and brand. 

Thank you again.

Using this,

 

IF (
AND(
ISNOTBLANK([Service Type]), ([Service Type] = [_THISROW].[Service Type]),
ISNOTBLANK([Service Type]), ([Application Type] = [_THISROW].[Application Type]),
ISNOTBLANK([Service Type]), ([Media Type] = [_THISROW].[Media Type]),
ISNOTBLANK([Brand]), ([Media Type] = [_THISROW].[Brand])
),
Select(Laminate[Finish],AND(
[Service Type]=[_ThisRow].[Service Type],
[Application Type]=[_ThisRow].[Application Type],
[Media Type]=[_THISROW].[Media Type],
[Brand]=[_THISROW].[Brand],
[Matching Media] = [_THISROW].[Range]
)
)+LIST("None"),
“”
)

 

I get the following error: 

"IF function is used incorrectly:the second input (if-result) and third input(else-result) should have the same type."

 

Checking out this link: https://help.appsheet.com/en/articles/2355953-if

and comparing our code against this:

IF(
  IN(
    WEEKDAY(TODAY()),
    LIST(1, 7)
  ),
  "It's the weekend!",
  "It's a weekday."
)

 It appears to be structured the same so I'm not sure what I am doing wrong?

IF (
AND(
ISNOTBLANK([Service Type]), ([Service Type] = [_THISROW].[Service Type]),
ISNOTBLANK([Service Type]), ([Application Type] = [_THISROW].[Application Type]),
ISNOTBLANK([Service Type]), ([Media Type] = [_THISROW].[Media Type]),
ISNOTBLANK([Brand]), ([Media Type] = [_THISROW].[Brand])
),
Select(Laminate[Finish],AND(
[Service Type]=[_ThisRow].[Service Type],
[Application Type]=[_ThisRow].[Application Type],
[Media Type]=[_THISROW].[Media Type],
[Brand]=[_THISROW].[Brand],
[Matching Media] = [_THISROW].[Range]
)
)+LIST("None"),
LIST(“”)
)

@Rifad Thank you. Your code works and although I don't understand it yet, I will analyse it until I do.

One issue I have found with it though and I will try and see if I can edit it to make it work but the dropdown menu with the added option 'None'  shows after the first selection is made, it's not until the last dropdown selection has been chosen that the final matt and gloss options show. I would prefer it to all show at the same time  which is the reason I've not accepted it as an answer. 

Thank you and it does answer my question but I need to sort this one little part.

I have also noticed issue before and I am not sure if that was a bug or If i was doing something wrong. Let's see if someone from community come up with solution for that.


@JuanMata wrote:

@Rifad Thank you. Your code works and although I don't understand it yet, I will analyse it until I do.

Just wrapped the "" with LIST() 

[column] = [_ThisRow].[column]

oustide a table lookup function, is equivalent to: [column] = [column]; always TRUE. 

Use this:

IF(
  AND(
    ISNOTBLANK([Service Type]), 
    ISNOTBLANK([Application Type]),
    ISNOTBLANK([Media Type]),
    ISNOTBLANK([Brand]),
    ISNOTBLANK([Range])
  ),
  SELECT(Laminate[Finish], AND(
    [Service Type] = [_ThisRow].[Service Type],
    [Application Type] = [_ThisRow].[Application Type],
    [Media Type] = [_ThisRow].[Media Type],
    [Brand] = [_ThisRow].[Brand],
    [Matching Media] = [_ThisRow].[Range]
  )) + LIST("None"),
  LIST("")
)

 

Thank you and more importantly, I’m starting to understand it.

Top Labels in this Space