The image in a billboard layout has an invalid value for "document". "document" must not be null

Hi all,

uploaded the documents and showing those documents to the user but i facing error in site page showing 

"expression evaluation error [evaluation ID = aae0b:d617b] in rule 'sha_imagelist' at function a!forEach [line 23]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!billboardLayout  [line 35]: The image in a billboard layout has an invalid value for "document". "document" must not be null".

I checked it by using different function like fco_hasvalue and fco_isnullorempty still i have this issue can anyone help me to resolve this error

 a!localVariables(
  
   local!listingData:rule!SHA_LISTING_EXPRUL(listingId:index(ri!listing,"listingId",null)),
   local!houses: rule!SHA_qe_getDocuments(
     entityId: index(ri!Document,"entityId",null)
   ),
   local!address:rule!SHA_qe_toGetPropertyAddressDetails(
     listingId: local!listingData
   ),
     local!appCount: length(local!listingData),
     local!colCount: 4,
     local!absoluteDiv: local!appCount/local!colCount,
     local!quotient: quotient(local!appCount,local!colCount),
     local!rowCount: if(
       local!absoluteDiv = local!quotient,
       local!quotient,
       local!quotient + 1
     ),

     
   
   {
     a!forEach(
       items: 1+enumerate(local!rowCount),
     expression: a!columnsLayout(
       columns: a!localVariables(
         local!indexes:(1+enumerate(local!colCount))+(local!colCount*(fv!item-1)),
         local!indexedVaues: rule!FCO_removeNull(index(local!listingData,local!indexes,null)),
         local!Vaues: rule!FCO_removeNull(index(local!houses,local!indexes,null)),
         local!Add: rule!FCO_removeNull(index(local!address,local!indexes,null)),
      a!columnLayout(
           contents: {
             a!cardLayout(
               contents: {
                 a!billboardLayout(
                   backgroundMedia:a!documentImage(
                     document:
                     /*if(*/
                       /*rule!FCO_isNullOrEmpty(local!Vaues),*/
                       /*{},*/
                       {index(local!Vaues,fv!item,null)}
                   ),
                   height: "SHORT",
                   marginBelow: "NONE",
                   overlay: a!barOverlay(
                     contents: 
                       {
                         a!sideBySideLayout(
                           items: {
                             a!sideBySideItem(
                               item: a!richTextDisplayField(
                                 label: "Address",
                                 labelPosition: "COLLAPSED",
                                 value: a!richTextItem(
                                   text: index(index(local!Add,"addressline1",null),fv!item,null),
                                   size: "MEDIUM",
                                   style: "STRONG"
                                 )
                               )
                             ),
                             a!sideBySideItem(
                               item: a!richTextDisplayField(
                                 label: "City & State",
                                 labelPosition: "COLLAPSED",
                                 value:index(index(local!Add,"city",null),fv!item,null) & "," & index(index(local!address,"province",null),fv!item,null),
                               ),
                               width: "MINIMIZE"
                             )
                           },
                           alignVertical: "MIDDLE",
                           showWhen: rule!FCO_hasValue(
                             index(local!Add,fv!item,null)
                           ),
                           stackWhen: "TABLET_LANDSCAPE"
                         )
                       },
                       style: "DARK"
                   ),
                 
                 ),

               },
               showBorder: rule!FCO_hasValue(
                 index(local!Add,fv!item,null)
               ),
             ),
             a!cardLayout(
             contents: a!sideBySideLayout(
               items: {
                 a!sideBySideItem(
                   item: a!richTextDisplayField(
                     label: "Price",
                     labelPosition: "COLLAPSED",
                     value: a!richTextItem(
                       text:index(index(local!indexedVaues,"price",null),fv!item,null),
                     
                     size: "LARGE",
                     style: "STRONG"
                     )
                   )
                 ),
                 a!sideBySideItem(
                   item: a!richTextDisplayField(
                     label: "Beds",
                     value: a!richTextItem(
                       text:index(index(local!indexedVaues,"bedRooms",null),fv!item,null)
                     )
                   ),
                   width: "MINIMIZE"
                 ),
                 a!sideBySideItem(
                   item: a!richTextDisplayField(
                     label: "Baths",
                     value: a!richTextItem(
                       text:index(index(local!indexedVaues,"bathRooms",null),fv!item,null)
                     )
                   ),
                   width: "MINIMIZE"
                 ),
                 a!sideBySideItem(
                   item: a!richTextDisplayField(
                     label: "Sq. Ft.",
                     value: a!richTextItem(
                       text:index(index(local!indexedVaues,"squareFootage",null),fv!item,null)
                     )
                   ),
                   width: "MINIMIZE"
                 )
               },
               showWhen: rule!FCO_hasValue(
                 index(local!indexedVaues,fv!item,null)
               )
             ),
             showBorder: rule!FCO_hasValue(
               index(local!indexedVaues,fv!item,null)
             )
           )
           },
          width: "NARROW_PLUS", 
)
         )
       )
       )
       

 }
 )
 
 
 
  


  
  

  Discussion posts and replies are publicly visible

Parents Reply
  • It's hard when I can't play around with it myself but it looks like your dynamic displaying of cards is based off the number of listings. The way the retrieval of document ids appear to have been implemented you lose the information of which document id belongs to which listing and so would only make sense if it was guaranteed to match in order and length the listings. As this isn't the case I can't see how you can iterate through listings and know which document id image to show.

    Could be totally wrong but I feel like you need to retain somehow what document id belongs to which listing in order for this to work.

Children