Large Binary Data Entities
Application Type
Mobile

Good afternoon, our app allows field inspectors to take photos, scan documents or generate report at a site and then produce a PDF with two photos per page and some descriptions under each.  The home screen/Project Sceen is a list-group of all the projects the user has created and either has or will go take photos of.  

What I'm trying to do:

In short, if user has visited the site and took his photos, we need a photo (the first photo taken) to show within the project list on that home screen/project screen. Below is an example of the project screen and the photo displayed is the first photo within the Photo entity for that ProjectId (one to many relationship, one project to many photos).  

With the understanding I have a screen displaying in a list group the Projects entity how could I have an image within that list display the first photo taken of all the photos in the photo entity for that project?  If anyone knows any insight or has ideas that could help, I would greatly appreciate it.  

What I'm trying to avoid:

 I'm concerned with the project screen seeing delays in calling that entity to retrieve the first photo of the group of photos taken under that projectid. How can I call the first picture of that ProjectId's > Photos for the picture.   


mvp_badge
MVP

Hi Cody,

For the mentioned use case, I would suggest you consider the project ListItem - Image section to be a Block element i.e. 

  • Define a Block that does have an input parameter called ProjectId
  • Within the Block, you would have an Aggregate called GetProjectPhotoByProjectId
  • The aggregate GetProjectPhotoByProjectId will have a Filter condition ProjectPhoto.ProjectId = ProjectId (input parameter) and also Sorting ProjectPhoto.CreatedOn Ascending
  • Set the GetProjectPhotoByProjectId aggregate Max. Records property value to 1
  • And also, Include an Image widget within the Block, which will be mapped with the GetProjectPhotoByProjectId Aggregate result set attribute value called ProjectPhoto.BinaryContent


I hope this helps you!


Kind regards,

Benjith Sam

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.