Hi,
I'm building a "Kudos" app. I have a gallery of thank you cards, and when you select "read more" it popups with all the card details.
I have 2 forms being displayed (pulling from the same list) so I could format it the way I wanted. I have an image behind the forms, and when I went to add code to change the image based on specific data I realized my image needs to be inside the form to work.
This is the code I use in the main gallery to display the correct image based on the directorate the employee works in
If(nDirectorate.Value = "FMD", CONTENTbox_blue [, nDirectorate.Value = "AQD",CONTENTbox_teal],CONTENTbox_yellow)
nDirectorate is a choice column in my sharepoint list. This works great if the image is located in a form.
Is there either a way to pass the variable nDirectorate.Value = "FMD" when I declare the popup=true? Or, is there a way to make an image stretch larger than the form?
Here's a screenshot of it (the image works, but I'd like to conditionally set the image based on which directorate the employee works in)
Thanks!
Solved! Go to Solution.
Hi @aharsh ,
Do you want the image to be set based on which image was selected in the gallery?
Could you tell me the setting of the image in the gallery?
Usually, we do not use image to represent the selected item in the gallery.
We use a field to justify.
For example:
field1 is one field in your gallery's Item. It could have these value:
"AQD", "FMD","OD"
Then you could set the popup image control's Image like this:
If(Galleryname.Selected.field1 = "AQD", CONTENTbox_blue,
Galleryname.Selected.field1= "FMD",CONTENTbox_teal
Galleryname.Selected.field1= "OD",CONTENTbox_purple,
CONTENTbox_yellow
)
//please replace with your Galleryname, fieldname
CONTENTbox_blue, CONTENTbox_teal,CONTENTbox_purple,CONTENTbox_yellow should be some images names
Best regards,
Hi @aharsh ,
Do you want to change this image's size based on nDirectorate.Value value?
The image is just a component of a form.
Firstly, I'm afraid it's not supported to make a component of a form bigger then the form.
Secondly, if you want to make it larger, you could insert another popup window with the same picture.
Then set the new popup window larger than this form.
Secondly, could you describe more clearly about this sentence:
pass the variable nDirectorate.Value = "FMD" when I declare the popup=true?
The nDirectorate.Value will not change if you declare the popup=true.
Best regards,
Thank you @v-yutliu-msft for taking time to respond.
Since I can't make the image larger than the form container, how would I conditionally choose the image?
On my gallery screen I have an image in my form and I conditionally set that image using this code:
If(nDirectorate.Value = "AQD", CONTENTbox_blue, If(nDirectorate.Value = "FMD",CONTENTbox_teal, If(nDirectorate.Value = "OD",CONTENTbox_purple, CONTENTbox_yellow)))
When I open the popup window I use this code:
UpdateContext({Popup:true})
When the window opens, I want the image to be set based on which image was selected in the gallery. I tried this, but it didn't work. I'm not sure where to declare this condition and what the code should look like.
If(nDirectorate.Selected = "AQD", CONTENTbox_blue, If(nDirectorate.Selected = "FMD",CONTENTbox_teal, If(nDirectorate.Selected = "OD",CONTENTbox_purple, CONTENTbox_yellow)))
Hi @aharsh ,
Do you want the image to be set based on which image was selected in the gallery?
Could you tell me the setting of the image in the gallery?
Usually, we do not use image to represent the selected item in the gallery.
We use a field to justify.
For example:
field1 is one field in your gallery's Item. It could have these value:
"AQD", "FMD","OD"
Then you could set the popup image control's Image like this:
If(Galleryname.Selected.field1 = "AQD", CONTENTbox_blue,
Galleryname.Selected.field1= "FMD",CONTENTbox_teal
Galleryname.Selected.field1= "OD",CONTENTbox_purple,
CONTENTbox_yellow
)
//please replace with your Galleryname, fieldname
CONTENTbox_blue, CONTENTbox_teal,CONTENTbox_purple,CONTENTbox_yellow should be some images names
Best regards,
Incredible @v-yutliu-msft , I had given up and made it a default image, but you helped me make it work!! Thank you so much!
I had to add .value, but it works great. Thank you!
If(GalleryName.Selected.FieldName.Value = "AQD", detailsBG_Blue, GalleryName.Selected.FieldName.Value = "FMD",detailsBG_teal,
GalleryName.Selected.FieldName.Value = "OD",detailsBG_purple, detailsBG_yellow )
User | Count |
---|---|
196 | |
124 | |
88 | |
48 | |
41 |
User | Count |
---|---|
281 | |
163 | |
138 | |
80 | |
76 |