Skip to main content

Randomly Displaying a Single SharePoint Item on Refresh

This is how:

1.
Create a new Data View web part in SharePoint Designer that displays all records in the format you want. We will end up only showing one record, so keep that in mind when you are laying this out.
2. Open the Filter dialog
3. Do not add any clauses, instead check the Add XSLT Filtering box and click Edit
4. Create your XSLT filter. You can just paste in the following code:
[position() = (substring(ddwrt:FormatDateTime(ddwrt:TodayIso(),1033,":mm:ss"),6,2) mod count(/dsQueryResponse/Rows/Row))+1]
5. Click Ok and save the page in SharePoint Designer
6. Check your work in your browser. Refresh the page to see the item rotate.

Comments

viji said…
Hi,

I have tried the XSLT for random display.
In the designer when I refresh the data source it displays correctly ie it rotates between all items in the list.
But when i view in the browser it picks from first 10 items in the list for display, its failed to pick above 10.

So it rotates within 10 items.

Do you have any idea.

thanks,
Viji