List of pictures in HTML
List of pictures in HTML
Hello everyone,
I have a BO "Inspections" with an attribute "Inspections.Pictures" , where this attributes has multiple relationship to the BO "Album".
The BO "Album.Photos" contains the actual picture. The pictures are stored in file system.
I also added a "Album.URL" field where the actual path is saved.
In a form of "Inspections" I would like to show in a HTML section the list of all the pictures in "Inspection.Pictures"
I tried already with LIST or LIST_TABLE but no luck.
I wanted to insert HTML tag something like that:
<<LIST(Inspections.Pictures, 'Photo ', 'Title', 'Caption')>>
OR
<<LIST(Inspections.Pictures, '<img src="URL"> ', 'Title', 'Caption')>>
but no luck.
Any suggestion?
Thanks
Sergio
I have a BO "Inspections" with an attribute "Inspections.Pictures" , where this attributes has multiple relationship to the BO "Album".
The BO "Album.Photos" contains the actual picture. The pictures are stored in file system.
I also added a "Album.URL" field where the actual path is saved.
In a form of "Inspections" I would like to show in a HTML section the list of all the pictures in "Inspection.Pictures"
I tried already with LIST or LIST_TABLE but no luck.
I wanted to insert HTML tag something like that:
<<LIST(Inspections.Pictures, 'Photo ', 'Title', 'Caption')>>
OR
<<LIST(Inspections.Pictures, '<img src="URL"> ', 'Title', 'Caption')>>
but no luck.
Any suggestion?
Thanks
Sergio
Re: List of pictures in HTML
Insert the Pictures attribute in the Inspections form.
Change the Widget for Pictures to "Custom list" and use {Photo} to refer to the photo attribute.
I think that should work.
Change the Widget for Pictures to "Custom list" and use {Photo} to refer to the photo attribute.
I think that should work.
Re: List of pictures in HTML
Thanks Joben,
however, I am not satisfied on how the custom list works for my application.
I want to use in the same form section a view mode and a edit mode of this pictures attribute. I am not allowed to have an attribute two times in the same section and therefore I wanted to try to use a "print out" of the pictures when in view mode, and a grid widget when in edit mode.
Cheers
Sergio
however, I am not satisfied on how the custom list works for my application.
I want to use in the same form section a view mode and a edit mode of this pictures attribute. I am not allowed to have an attribute two times in the same section and therefore I wanted to try to use a "print out" of the pictures when in view mode, and a grid widget when in edit mode.
Cheers
Sergio
-
- Posts: 1476
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: List of pictures in HTML
You need two forms. An edit form and a view form.
Re: List of pictures in HTML
Thanks PointsWell,
this is the only solution I know now, and the one I would like to avoid.
I guess then that embedding a list of pictures in HTML is not feasible?
-
- Posts: 1476
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: List of pictures in HTML
It is possible, you need to make a custom query. See the CRM and Sales Portal examples.
You just can't have the same element showing twice - so if you want it to be in different formats in edit and read mode you will need to create two forms.
Re: List of pictures in HTML
There are two ways I am thinking of that could work if you really want it to be in the same form. I can't really recommend it because they are a bit complicated.
1. You could create a text attribute (content: HTML) with a large max length. Let's call it PicturesHTMLfield.
Then use update rules to loop through all the related pictures and store it in an HTML table structure in this field. Then you can display the attribute in the form like: <<Inspections.PicturesHTMLfield>>
2. The other way I am thinking of is to have two separate relations to the Pictures BO. Like:
Inspections.Pictures
and
Inspections.PicturesHTML
Then you let update rules handle it so that if a picture is related via the Inspections.Pictures path, you make sure to INSERT that object in Inspections.PicturesHTML as well.
Then you should be able to display the attribute PicturesHTML and set it to a custom list, and it will not collide with your original Pictures attribute in the same form.
Re: List of pictures in HTML
1> this have already done. What I am missing if what HTML code I should put to print the LIST of these pictures using the URL code and list function. Somthing like:joben wrote: ↑Tue Dec 19, 2023 7:32 amThere are two ways I am thinking of that could work if you really want it to be in the same form. I can't really recommend it because they are a bit complicated.
1. You could create a text attribute (content: HTML) with a large max length. Let's call it PicturesHTMLfield.
Then use update rules to loop through all the related pictures and store it in an HTML table structure in this field. Then you can display the attribute in the form like: <<Inspections.PicturesHTMLfield>>
2. The other way I am thinking of is to have two separate relations to the Pictures BO. Like:
Inspections.Pictures
and
Inspections.PicturesHTML
Then you let update rules handle it so that if a picture is related via the Inspections.Pictures path, you make sure to INSERT that object in Inspections.PicturesHTML as well.
Then you should be able to display the attribute PicturesHTML and set it to a custom list, and it will not collide with your original Pictures attribute in the same form.
<<LIST(Inspections.Pictures, <img src='URL'>, 'Title', 'Caption')>>
?? Any suggestion?
2> This is indeed my backup solution!
Thanks
Sergio
Re: List of pictures in HTML
I am not sure if the LIST function is even compatible with pictures.srufini wrote: ↑Wed Dec 20, 2023 8:35 am 1> this have already done. What I am missing if what HTML code I should put to print the LIST of these pictures using the URL code and list function. Somthing like:
<<LIST(Inspections.Pictures, <img src='URL'>, 'Title', 'Caption')>>
?? Any suggestion?
2> This is indeed my backup solution!
Thanks
Sergio
I would do something like this:
Update Rule in inspections BO:
FIND Pictures WHERE (Pictures.Inspections=Inspections) IN BATCHES OF 1
Inspections.PicturesHTML=Inspections.PicturesHTML+`<tr><td><<Pictures.Title>></td><td><img src='/path/to/folder/<<Pictures.Picture>>'/></td></tr>`
Then create another rule so that the PicturesHTML attribute has a table element:
Inspections.PicturesHTML='<table>'+Inspections.PicturesHTML+'</table>'
I have not tested any of this code, but the main ingredient of using "IN BATCHES OF 1" to build a loop should absolutely work.
Performance and making sure the PicturesHTML field is always up to date will be something you will have to consider.
Re: List of pictures in HTML
Thank you!
I will give it a try.
Ciao
Sergio
I will give it a try.
Ciao
Sergio
joben wrote: ↑Wed Dec 20, 2023 10:24 amI am not sure if the LIST function is even compatible with pictures.srufini wrote: ↑Wed Dec 20, 2023 8:35 am 1> this have already done. What I am missing if what HTML code I should put to print the LIST of these pictures using the URL code and list function. Somthing like:
<<LIST(Inspections.Pictures, <img src='URL'>, 'Title', 'Caption')>>
?? Any suggestion?
2> This is indeed my backup solution!
Thanks
Sergio
I would do something like this:
Update Rule in inspections BO:
FIND Pictures WHERE (Pictures.Inspections=Inspections) IN BATCHES OF 1
Inspections.PicturesHTML=Inspections.PicturesHTML+`<tr><td><<Pictures.Title>></td><td><img src='/path/to/folder/<<Pictures.Picture>>'/></td></tr>`
Then create another rule so that the PicturesHTML attribute has a table element:
Inspections.PicturesHTML='<table>'+Inspections.PicturesHTML+'</table>'
I have not tested any of this code, but the main ingredient of using "IN BATCHES OF 1" to build a loop should absolutely work.
Performance and making sure the PicturesHTML field is always up to date will be something you will have to consider.