cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

gallery item image sudden error on existing code

I have code underneath for the image property of an image component in a gallery.

Worked for months now starts with an error on opening edit session.

Invalid argument type image, type record is expected (translated from dutch)
Image001 is a field of a a collection. The collection has been collected from a cds entity containg the image field image001.

On startup the collection is still empty.
If I remove the lines containing "ThisItem.Image001" the error disappears.

But I may leave one of these lines standing.

All logic escapes me at this point.

The switch statement seems broken (or changed?)

 

If(
   ViewMode<2
   ;Switch(
       Lower(ThisItem.FileExtension)
       ;"jpeg";ThisItem.Image001
       ;"jpg";ThisItem.Image001
       ;"bmp";ThisItem.Image001
       ;"png";ThisItem.Image001
       ;"ogg";soundicon
       ;"mp3";soundicon
       ;"wav";soundicon
       ;"mts";movieicon
       ;"mp4";movieicon
       ;"pdf";PdfIcon
       ;"xls";excel
       ;"xlsx";excel
       ;"doc";wordicon
       ;SampleImage
       )
    ;Switch(
            ThisItem.DierSoortId
            ;1;dog
            ;2;cat
            ;5;rabbit
            ;kh
            )
1 REPLY 1
Highlighted
Community Support
Community Support

Hi @HansHeintz ,

Do you mean that your switch formula broke?

You said:

The collection has been collected from a cds entity containg the image field image001.

On startup the collection is still empty.

Since there's no data in collection, so "ThisItem.FileExtension" will be invalid.

Here are some of my questions:

1)what is your app's onstart

2)what is this gallery's Items

3)where do you set this switch formula

4)the data type of FileExtension,DierSoortId

5)what are these: soundicon,movieicon,PdfIcon,excel,wordicon,dog,cat,rabbit,kh

 

If you could describe with screen shoots , it will be better.

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,592)