Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Portal Filter By Months Ahead Of Current Date

Featured Replies

I currently have a portal that I am filtering with 3 different global fields, all work fine. I would like to add a field to filter by a months block from current date. There is a sale date column in the form of 8/29/2017.

The date drop down filter field would have the following entries. The filter will be referenced to the current date.

If "3-6 mos" were selected only records in Dec 2017, Jan 2018 and Feb 2018 would show ( 3, 4 and 5 months from today's month).

This would be the drop down.

All Dates
< 0 mos
0-1 mo
0-3 mos
3-6 mos
6-9 mos
9-12 mos
>12 mos

This is what I currently have with the date filtering, using a custom function, this works fine.

( T20_ALL_OPPORTUNITIES::g_search_probability = 0
 or
T20_ALL_OPPORTUNITIES::g_search_probability   ≤  T20_ALL_OPPORTUNITIES::Sale_Probability )
 and
( T20_ALL_OPPORTUNITIES::g_search_priority = "All"
 or
FindWordPartsInText ( T20_ALL_OPPORTUNITIES::g_search_priority ; T20_ALL_OPPORTUNITIES::Priority ; 1 ))
 and
(IsEmpty ( T20_ALL_OPPORTUNITIES::g_search_opportunity )
 or
FindWordPartsInText ( T20_ALL_OPPORTUNITIES::g_search_opportunity ; T20_ALL_OPPORTUNITIES::Opportunity & ¶ & T20_ALL_OPPORTUNITIES::Account ; 1 ))

I see two separate questions here. The first one is how to extract the two numbers from the value selected in the drop-down. The second question is how to use them in a filtering expression. The first question is actually the more difficult one, esp. since you have values that break the pattern (and will also require a different filtering expression).

To answer the second question, you could do something like:

Let ( [
start = ...................... ;
end = ....................... ;
startDate =  Date ( Month ( Get ( CurrentDate ) ) + start ; 1 ; Year ( Get ( CurrentDate ) ) ) ; 
endDate =  Date ( Month ( Get ( CurrentDate ) ) + end ; 1 ; Year ( Get ( CurrentDate ) ) )
] ;
startDate ≤ PORTAL_TO:YourDatefield
and
PORTAL_TO:YourDatefield < endDate
)

 

  • Author

Thanks for the expression it worked great, only had to had a plus 1 to the end date to include last month. To extract the month numbers just created a dropdown with the selection list, then a script with if statements to set the Start/End fields that are used in your expression. Thanks again.

image.png.02d4841fe75e3ca105fb0099019376b0.png

 

1 hour ago, laguna92651 said:

then a script with if statements to set the Start/End fields that are used in your expression.

You can use Case() statements within the filtering expression itself instead.

  • Author

I will give that a try, is there an advantage to using the case statements in the portal?

2 hours ago, laguna92651 said:

is there an advantage to using the case statements in the portal?

You save 2 global fields, a script and a script trigger.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.