How to get asset name and the attributes of the asset when we know Asset ID in WCS

565 Views Asked by At

I am able to get Asset Id and Asset type present in Recommendation asset. However once I get both of them . I am unable to get asset name attribute and the user-defined attributes of the asset using either Asset Id or on using both both Asset Id and Asset type. Below is the code: So how do I get asset name and the user-defined attributes of the asset ?

<commercecontext:getrecommendations 
collection='<%=ics.GetVar("op_rec_men_name")%>'
maxcount="10"  listvarname="list_allassets"/>

<br/> Asset Details:

 <ics:listloop listname="list_allassets">

    <ics:listget listname="list_allassets" fieldname="assetid" 
     output="op_assetid"/>
     Asset ID : <%=ics.GetVar("op_assetid")%> <br/> 

    <ics:listget listname="list_allassets" fieldname="assettype" 
    output="op_assettype"/>
    Asset Type: <%=ics.GetVar("op_assettype")%> <br/> 

    <%-- Using Asset Id and Asset Type values and defining "setasset"--%> 
    <assetset:setasset name="msd" type='<%=ics.GetVar("op_assettype")%>' 
    id='<%=ics.GetVar("op_assetid")%>'/>

    <%-- Trying to get value of user-defined attribute "Page_FS2_Int_SV" 
     corresponding to the above Asset Id and Asset Type. This part of code 
     is not working from here --%>
     <assetset:getattributevalues name="msd"  attribute="Page_FS2_Int_SV"  
      listvarname="list_int_sv"  />
      Page_FS2_Int_SV: <string:stream list="list_int_sv" 
      column="namevalue"/> 
      <br/>

      <%-- Tried value as "name", "Name", "assetname" but did not work --%>         
      <assetset:getattributevalues name="msd"  attribute="name"  
      listvarname="list_asset_name"  />
      Asset Name: <string:stream list="list_asset_name" column="namevalue"/> 
      <br/>  

    </ics:listloop>

Expected Output: Asset Name and values of user-defined attributes of the Asset

I am successfully getting Asset Id and Asset Type but not Asset Name and values of user-defined attributes of the Asset.

Query : So how do I get Asset Name and values of user-defined attributes of the Asset ?

1

There are 1 best solutions below

0
On

You need to specify typename attribute in assetset:getattributevalues tag. You can debug your code to verify the same, just insert:

<ics:clearerrno/>
<assetset:getattributevalues .....>
<ics:geterrno/>

This should print error number which tells you that you're missing to include an attribute in the tag!