0

On Sharepoint Online, I am trying to build a grid-view for Search Center search results. I am unable to extract the values of either OWSBOOL or OWSCHCS properties.

I have added ManagedPropertyMappings for my custom properties:

    'Filename':'Filename',
    ...
    'ImageOWSBOOL':'ImageOWSBOOL',
    ...
    'ECStatusOWSCHCS':'ECStatusOWSCHCS'

I have modified a stock Item_Display template:

        <div style="min-width:60px;width:60px;max-width:60px;display: table-cell;white-space:nowrap;overflow:hidden;-ms-text-overflow:ellipsis;-o-text-overflow:ellipsis;text-overflow:ellipsis;">
            _#=ctx.CurrentItem.ImageOWSBOOL=#_
        </div>
        ...
        <div style="min-width:100px;width:100px;max-width:100px;display: table-cell;white-space:nowrap;overflow:hidden;-ms-text-overflow:ellipsis;-o-text-overflow:ellipsis;text-overflow:ellipsis;">
            _#=formatProperties(ctx.CurrentItem.ECStatusOWSCHCS)=#_
        </div>

Other custom properties are displayed in the search results, but I don't know how to parse the values out of these two properties (the 'No' value in the Image column is the result of an if(ctx.CurrentItem.ImageOWSBOOL===1) else ('No') call:

enter image description here

So, does anyone have the decoder ring to decypher these properties?

Thx!

0

The values in this custom boolean property were either "True 1" or "False 0".

IE11 doesn't support string.includes() (although IE12/Edge does).

So, I parsed the value of my custom property named ImageOWSBOOL as follows:

if (ctx.CurrentItem.ImageOWSBOOL.indexOf("True")!=-1) { Do Stuff } else { Do Other Stuff}

I haven't solved the OWSCHCS property parsing yet...

Thx!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.