Problem with getting first image from list of images

Hey guys,

So I have a table, and the table has a nested table to add images.
I want to take the first related image and use it as the background in the detail view of the main form.

I have acreated a virtual column and have set that as the main image.

The virtual columns formula is this:

`any(TOP(SELECT(Maintenance Images[Image], ([ID] = [_THIS].[id]), FALSE), 1))`

Note, this expression could significantly impact sync time.

One randomly chosen value from this list (
โ€ฆTOP(
โ€ฆThe list of values of column โ€˜Imageโ€™
โ€ฆfrom rows of table โ€˜MAINTENANCE IMAGESโ€™
โ€ฆwhere this condition is true: ((The value of column โ€˜IDโ€™) is equal to (The value of โ€˜IDโ€™ from the row referenced by โ€˜Repair Image Detailโ€™))
โ€ฆ1))

This does not seem to return a image, Am I doing something wrong?

Any help would be splendid,

Stay Safe,

Solved Solved
0 5 392
1 ACCEPTED SOLUTION

I assume your table has a ref_rows virtual column โ€œRelated Maintenance Imagesโ€?

You can greatly simplify your expression by using that.

Also, ANY(TOP(โ€ฆ,1)) is pretty much equivalent to INDEX(โ€ฆ,1)

So, this should work:

INDEX([Related Maintenance Images][Image] , 1)

As far as what is wrong with your expression, not sure, but I would suspect the condition in the select statement. Try to remove the any() and top(), and make sure the select is actually returning what it should be. Perhaps [ID], is the key-column of the images table, and not the ref column to the parent table?

View solution in original post

5 REPLIES 5

I assume your table has a ref_rows virtual column โ€œRelated Maintenance Imagesโ€?

You can greatly simplify your expression by using that.

Also, ANY(TOP(โ€ฆ,1)) is pretty much equivalent to INDEX(โ€ฆ,1)

So, this should work:

INDEX([Related Maintenance Images][Image] , 1)

As far as what is wrong with your expression, not sure, but I would suspect the condition in the select statement. Try to remove the any() and top(), and make sure the select is actually returning what it should be. Perhaps [ID], is the key-column of the images table, and not the ref column to the parent table?

Amazing, Searching google and on the community I came up with Top , Learned something new again. Amazing. Thanks,

You might also try searching our documentation site.




Steve
Platinum 4
Platinum 4

[_THIS] should be [_THISROW].

Thanks Steve, Extremely Helpful

Top Labels in this Space