Question
I have a table with products where I specify the quantity of components. I wanted to create a preview of the component from another table, where I assign an image to each component.
In the code for formatting the product field:
p1: panelImg(img: $img)
img: select(table: 'foto'; field: 'img'; where: 'id' = $#nfv)
But it doesn't work. What am I doing wrong?
Answer
Panel functions in field formatting are executed from a code section starting with p1=:
p2=:
and so on.
The second point is that the parameter img of the panelImg function needs to be passed the file name on the HDD. In the File type field, a rowlist is stored, one of the columns of which file
contains this name on the HDD.
That is, to display the first image from the picture field in the foto table, you need to add the following field formatting code:
p1=: panelImg(img: $img[0][file])
img: select(table: 'foto'; field: 'picture'; where: 'id' = $#nfv)