Hide spfx adaptive card when there is no data and show when data is available

31 views Asked by At

I want to hide the spfx adaptive card when there is no data while querying sharepoint list.

If data is available, the spfx adaptive card should show.

    const renderListDataParams: IRenderListDataParameters = {
        ViewXml: "<View><Query><Where><Neq><FieldRef Name=\'Status\'/><Value Type='Text'>Resolved</Value></Neq></Where><OrderBy><FieldRef Name='Modified' Ascending='False'/></OrderBy></Query></View>",            
    };
            
    const query = new Map<string, string>();      

    const data = await sp.web.lists.getByTitle('test list').renderListDataAsStream(renderListDataParams, null, query);
            
    const rows = data.Row;

    if(rows.length > 0)
    {
    show adaptive card
    }
    else
    {
    hide adaptive card so that it won't take any space in viva connections dashboard
    }

Please help.

So when the caml query returns item count > 0 I would like to show the adaptative card in dashboard else hide

0

There are 0 answers