Skip to main content
Nintex Community Menu Bar
Question

Mobile: 'filter' model by date, and scroll through dates on swipe

  • July 9, 2024
  • 6 replies
  • 24 views

Forum|alt.badge.img+18

Goal: On load of mobile page show events where the Date__c field is today. Swipe left to see events for the next day; swipe right to see events for the previous day.

Since the mobile page builder doesn’t have tables and filters, I’m using javascript to interact with a condition on the model. The model starts with filterable condition Date__c = ‘TODAY’

I wrote the following nextDay snippet:

var model = skuid.$M('ApptInteractions'),<br>&nbsp; &nbsp; condition = model.getConditionByName('Date'),<br>&nbsp; &nbsp; curDate = condition.value;<br>&nbsp; &nbsp;&nbsp;<br>var jsDate = skuid.time.parseSFDate(curDate);<br>jsDate.setDate(jsDate.getDate()+1);<br>var nextDate = skuid.time.getSFDate(jsDate); <br>model.setCondition(condition, nextDate);<br>model.updateData();

The problem I’m running into is that condition.value = ‘TODAY’, which apparently is not a date. So I end up with jsDate = FALSE.

I could use the Date__c field from the first row in the model to get curDate, but there may be a situation where there aren’t any rows in the model, and I still want to be able to see the new and previous.

Anyone see a way around this?

This topic has been closed for replies.

6 replies

Forum|alt.badge.img+20

Write an if statement to look for ‘TODAY’. If so, then create a javascript date object for today.


Forum|alt.badge.img+18
  • Author
  • 2192 replies
  • July 9, 2024

Brilliantly simple. Thanks!


Forum|alt.badge.img+18
  • Author
  • 2192 replies
  • July 9, 2024

Running into another problem. I can set the filter value to a date, but none of my rows with that date are showing up. I think it is because the field is a DateTime?

Is there any way to communicate to the filter “this day at any time?” Rather than “This date at a specific time.”


Forum|alt.badge.img+20

Create a formula field on the object to calculate the date from the date time field. Then use this in your model.


Forum|alt.badge.img+18
  • Author
  • 2192 replies
  • July 9, 2024

Perfect.


Forum|alt.badge.img+17
  • Nintex Employee
  • 3766 replies
  • July 9, 2024

Pat.  You are approaching guru status.