Good day, I am having some trouble with the l...

Good day, I am having some trouble with the lookup function.

Let me explain a bit more. I have a form that allows the user to enter data, the criteria I want the lookup to take into account is called “Diagnosis”. Then below that I have an Image field that should display an image based on the "Diagnosis performed. The “Diagnosis” field is a list that the app gets from the same sheet as where the image is.

I get expression valid but nothing is displayed.

=LOOKUP([Diagnosis], “Diagnosis and Treatment”, “Diagnosis”, “Standard Treatment Guide”)

The first [Diagnosis] is the form selection, correct? Then “Diagnosis and Treatment” is the sheet name where the Diagnosis list comes from as well as where the images are kept. Then the last “Diagnosis” in my expression refers back to the list?

And lastly the “Standard Treatment Guide” refers to the column name where the images are.

Did I make a mistake somewhere?

0 33 702
33 REPLIES 33

Try with… LOOKUP([_THISROW].[Diagnosis],Diagnosis and Treatment,Diagnosis,Standard Treatment Guide)

@Aleksi_Alkio I copied the expression you gave but I still don’t get the image to load, also no errors.

Which value are you looking for? Text or image?

What I want to get is an Image based on what “Diagnosis” is selected, I converted some PDF pages to images and want to show the specific image when that diagnosis is selected. Currently I only have 1 image as a test in the sheet.

The problem with the image is this… because you are using the EnumList as a source, you should bring multi images but you have field only for one image. If the user can choose as many options as he/she wants, you should have image fields for all options.

But wouldn’t it just show at least image then?

Example… user chooses 5 options from the dropdown, you should have 5 different image or show columns to show those 5 images. If you have only one image column, it will show only the first image.

Yes that is correct, but I am not winning with the lookup function, it’s probably something simple that I am missing

So… are you saying the first image would be enough?

Yes I will add extra image fields if or when I get the lookup function to work like I want. For now just getting the correct image to display for what diagnosis I select is all I need

Just an update on my progress, I am now able to hav the image load from my lockup but it is static, so no matter what I select it stays that one image, I know I only have one image in my sheet at the moment but when I select something else that doesn’t have that image associated with it it should remain blank, no?

What’s the formula?

What is the app name and account ID? I can check the reason quickly if it’s okay for you.

#ERROR!

I used the one you gave and removed “[_THISROW]” because it was giving me the wrong return value

You both fields seems to be EnumLists… Diagnosis and Illness. Are you trying to verify these two fields so when they match, show the image?

What do you mean by both? There should only be one and that is “Diagnosis”. The diagnosis must select a corresponding image from my sheet.

In your “Diagnosis and Treatment” table you have the Illness column and that field contains the same Enumlist values as Diagnosis field might have. For example Illness: Abdominal pain. If these fields would be Enum, your lookup formula should like this…

LOOKUP([_THISROW].[Diagnosis],Diagnosis and Treatment,Illness,Standard Treatment Guide)

I don’t use illness as a part of the form, I only use that to make up the enumlist of Diagnosis, if I use your formula then no image is retrieved

Please check this article about LOOKUP expression and you will get the idea… help.appsheet.com - List Expressions and Aggregates List Expressions and Aggregates help.appsheet.com

I have read through that article but it would seem that I am stupid because I still cant it to work like I want. The best I can do is display one image from the lookup and only that one image… I am at a loss, sorry but thanks for all your help anyway

Dont know if you still have access to the app or not, if you do, there are a few extra images now, the images appear when I select a diagnosis , however it seems to select an image closest to the diagnosis if there is no image present next to the “Illness” in the sheet. I am curious about this part: “One randomly chosen value from this list ( …The list of values of column ‘Standard Treatment Guide’ …from rows of table ‘Diagnosis and Treatment’ …where this condition is true: ((The value of column ‘Illness’) is equal to (The value of ‘Diagnosis’ from the row referenced by ‘Concatenate’)))”

When I verify my expression this is the description I get, I am so close to getting this thing right I can feel it

You haven’t described yet how do you want to compare these two tables and their values. It doesn’t matter what expression we are talking about, but when comparing two different values, they need to match somehow. At this moment you are comparing two lists and that won’t work with the lookup expression directly.

@Aleksi_Alkio Account ID: 291443 Translate

I actually don’t want to compare two tables, I simply want one criteria for what image needs to be displayed, but I am struggling to achieve that, the second table is there because I am testing different options on how to get it to work

Is there a place where I can see sort of a breakdown of what is happening with the expression, like a step by step to see where it is all going wrong?

You can see it from the expression builder if you test it.

If your both Diagnosis and Illness are Enum fields (not EnumList), this formula will work. LOOKUP([_THISROW].[Diagnosis],Diagnosis and Treatment,Illness,Standard Treatment Guide)

What is the app name?

@Aleksi_Alkio app is “my new app” doesnt have a name yet

If you want to show an image on that field (ST Guide), why the “Standard Treatment Guide” column is then a text field?

Another issue is the column (Diagnosis) type. It’s an EnumList field and you can’t use LOOKUP in that way because it tries to find only one record.

I see I overlooked the text field setting when adding that table, sorry about that, I have tried using just a “list” but it says only virtual columns can have the list property.

Is there another way that could get the result I want?

Top Labels in this Space