Skip to main content
Solved

Share a formula to get the current FinPeriod to be used in Generic inquiry


Forum|alt.badge.img+5
  • Captain II
  • 398 replies

Hello,

    Irina previously shared a trick to get the current finperiod as default in GI.  This worked fine in 2020R2, but it does not work in 2021R2. 

https://community.acumatica.com/reports-and-generic-inquires-83/how-to-make-the-current-financial-period-used-by-default-in-a-generic-inquiry-158?postid=36837#post36837

 

Normally, we just only want the current period data.

The below trick is working. If someone has better solution, please also share. Thanks.

 

Although it shows 06-2022 in screen, it actually stores as 202206 in DB, so I am using the below formula to calculate current fin period.

=IIf( Month( Today())>9, Concat( CStr( Year( Today())),CStr( Month( Today()))),  Concat( CStr( Year( Today())),'0',CStr( Month( Today()))))
And then put it in GI conditions.

 

Best answer by vkumar

Hi @ray20 

Slight changes, something I used earlier, this works as well. 

=iif(Month(Now())<10,CStr(Year(Now()))+'0'+CStr(Month(Now())),CStr(Year(Now()))+CStr(Month(Now())))

 

Regards,

 

View original
Did this topic help you find an answer to your question?

8 replies

A possibly simpler formula

= CStr(Year( Today() )) + PadLeft(CStr(Month( Today() )), 2, '0')


Forum|alt.badge.img+12
  • Acumatica Support Team
  • 866 replies
  • Answer
  • July 9, 2022

Hi @ray20 

Slight changes, something I used earlier, this works as well. 

=iif(Month(Now())<10,CStr(Year(Now()))+'0'+CStr(Month(Now())),CStr(Year(Now()))+CStr(Month(Now())))

 

Regards,

 


Forum|alt.badge.img+3

These formulas assume that MasterFinPeriod was setup to match calendar periods. 

If using user defined periods or any other financial calendar that doesn’t match, formulas won’t work.

Why not just Cross join MasterFinPeriod in your GI and find the required period for whatever date is needed? 


Forum|alt.badge.img+5
  • Author
  • Captain II
  • 398 replies
  • July 21, 2022

@RoyceLithgo 
Yes, you are right. Our method has obvious limitations.
Can you give more details on your method?  Can you give us a simple example?


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2751 replies
  • July 28, 2022

Hi @ray20 - were you able to find a solution for your issue? Thank you!


Forum|alt.badge.img+5
  • Author
  • Captain II
  • 398 replies
  • August 18, 2022

 @vkumar @joshmagalich27 
Hi Folks, just to update.  @RoyceLithgo is right. we can join “FinPeriod” table to get the current or any period we want.
“PX.Objects.GL.FinPeriods.TableDefinition.FinPeriod”

Note: this table has multiple finperiods splitted by organization/company. So in order to avoide duplicated data, we have to carefully make the join condition like below:
 

 

Then we can use the Finperiod table, to get the period we want.
Below is to get the last period leveraging the “Start date” definitions of the period.

 


Forum|alt.badge.img+3
  • Pro II
  • 76 replies
  • August 19, 2022
ray20 wrote:

 @vkumar @joshmagalich27 
Hi Folks, just to update.  @RoyceLithgo is right. we can join “FinPeriod” table to get the current or any period we want.
“PX.Objects.GL.FinPeriods.TableDefinition.FinPeriod”

Note: this table has multiple finperiods splitted by organization/company. So in order to avoide duplicated data, we have to carefully make the join condition like below:
 

 

Then we can use the Finperiod table, to get the period we want.
Below is to get the last period leveraging the “Start date” definitions of the period.

 

Thanks for posting this but it’s not quite the way i do it. For finding the correct period, you want StartDate <= [ReportDate] and FinDate >= [ReportDate]. [ReportDate] being a parameter in this GI.

Here’s an example usage:

I then used MasterFinPeriod in the joins for other table relations. Depending on your needs you could also do Inner join to MasterFinPeriod if you want to filter each row of the Left table.


darylbowman
Captain II
Forum|alt.badge.img+13
vkumar wrote:

=iif(Month(Now())<10,CStr(Year(Now()))+'0'+CStr(Month(Now())),CStr(Year(Now()))+CStr(Month(Now())))

Shorter version:

=Concat(CStr(Year(Now())),PadLeft(CStr(Month(Now())),2,'0'))


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings