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 737
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