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.

Calc for performing find based on value list

Featured Replies

Hi Forum :).  

Always wondering/trying to learn if there is an easier way.  This does work but it seems I may have over complicated the calculation.

Basically I am selecting from a drop down (global), a value in a value list that will give me a range of aging criteria.  Based on that criteria, convert to dates to perform a find (and sort).  This is for a basic aging report for finding balances due.

The calculation is for the Set Field script step.

Here's the Value list:

All
0-15
16-30
31-45
46-60
61-90
90+

And the screenshot shows the calc.  I figured 90+ and 'All' had to be calculated differently (for the way I'm trying it), and the other ranges can be converted the same basic way.

It does work, but like I said, always trying to learn if there is a better way.

Thanks for looking.  All comments, criticism welcomed.

SS2.png

Edited by Steve Martino
typo

Well, there's really no point in using the Let() function that way; the Case() function does all the work, and placing its result in a variable just to spit it right out serves no purpose other than to complicate the calculation unnecessary.

OTOH, you should use a variable in order to perform the Substitute(0 part only once.

 

P.S. Post your code as code, so we don't have to retype it.

  • Author

Thanks Comment, for...well...your comments :)

P.S. Post your code as code, so we don't have to retype it.

Sorry about that but I can't remember where I saw how to do that.

Sorry about that but I can't remember where I saw how to do that.

Copy/paste? For best results, click the 'Add code' button [<>] and paste your code into the resulting window.

  • Author
Let (
AgeNum=
 Case(
   ImportFromQB::gAging = "All"; "<" & Get(CurrentDate);
   ImportFromQB::gAging = "90+" ;"<" & Get(CurrentDate)-90;
   Get(CurrentDate) - RightWords (Substitute ( ImportFromQB::gAging ;"-" ; "|" );1) & "..." & Get(CurrentDate) - LeftWords (Substitute ( ImportFromQB::gAging ;"-" ; "|" );1)
 );
AgeNum

)

Ahhh..thanks.  Didn't know about the <>

Edited by Steve Martino
typo

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.