Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fiscal Calender and Periods

Status
Not open for further replies.

iwells

Programmer
Oct 2, 2012
284
CA
Hi,

I'm starting to get a little deeper in to the API and now I'm trying to use the API to look up the fiscal years, periods and the end dates of the periods to populate combo boxes on a form.

I've started off with:

Set FiscalCalendar = mDBLinkCmpRW.GetFiscalCalendar

Simple enough so far, at this point I can use .GetFirstYear and .GetLastYear and loop to populate my combo for Year, but I'm struggling to setup AccpacAllFiscPds (which is what I'm assuming I need to use and not AccpacFiscalPeriod).

I'm trying to do something like:

Set AccpacAllFiscPds = FiscalCalendar.GetAllPeriods("CS", strFiscalYear, ?) but what I'm not understanding is the 3rd required parameter of the function is pVal as AccpacAllFiscPd. Once I get this setup I can then loop through this as well ... can someone correct/guide me on what I'm doing wrong on setting up this variable?

Thanks,
 
And of course .GetFirstYear doesn't work as I expected either so I could use some help on that too ... really wish the help file had some samples.
 
Um, what are you trying to achieve?


Sage 300 Certified Consultant
 
Side note.... select * from CSFSC returns all you need with less pain involved.
If you simple want to populate a combo box with Year then above is the simplest.
If you want periods and period end dates then the query gives that too.

Sage 300 Certified Consultant
 
I was trying to use the API functions rather than using CS0120 since I'm already using CS0120 for something else and you or tuba had previously said that multiple instances of CS0120 using different queries can cause issues.

What I'd planned to do was this:

Assign Fiscal Calendar
Assign All Fiscal Periods

If Not FiscalCalendar Nothing Then

Get First Year​
Get Last Year​

Loop to populate year
nested loop to populate periods​
increment year
 
You can use multiple instances of CS0120, no problem with that.
Just don't use the same CS0120 view for multiple queries, that is the problem. Destroy the view object before reusing it, or use a new view object.

Sage 300 Certified Consultant
 
I have a number of macros/apps where I have Year and Period combo boxes, on all of them I use CSFSC in a query, loop through the years and add them to your combo box. For periods use the PERIODS field to get either 12 or 13 defined in the year, use ENDDATEx for the period end date.

Sage 300 Certified Consultant
 
Or you could make your life difficult and use the views....

Sage 300 Certified Consultant
 
The only time I use the FiscalCalender view is when I want to get the Year/Period from a given date.

Sage 300 Certified Consultant
 
If you need information on any object in VBA then press F2, select AccpacCOMPAPI and go through the objects, you will find additional cryptic information there. That's what I use, you can figure most of it out from there.

Sage 300 Certified Consultant
 
Yea I've been looking there when you mentioned it before and found it very helpful, but in the case of these objects I find it cryptic as you said ... I'll give this a few more minutes of playing around and then just use CSFSC I think.

I can get the years, but the AccpacAllFscPds isn't going so well
 
Now I just want to know out of curiosity:

'this works
Set FiscalCalendar = mDBLinkCmpRW.GetFiscalCalendar

'this does not
blnTest = FiscalCalendar.GetAllPeriods("CS", "2017", AllFiscPds)

It doesn't work in the sense that AllFiscPds will still be empty and 2017 is an active year and I've also tried changing it to "2016" ... is CS the right PgmID?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top