Sage 100

 View Only
Expand all | Collapse all

Can anyone help me write some crystal code to tran

Greg Stiles

Greg Stiles09-05-2018 11:56

Robert Wood

Robert Wood09-06-2018 10:00

Greg Stiles

Greg Stiles09-06-2018 16:46

alan niergarth

alan niergarth09-07-2018 07:11

Greg Stiles

Greg Stiles09-07-2018 08:42

Dan Burleson

Dan Burleson09-11-2018 20:14

  • 1.  Can anyone help me write some crystal code to tran

    Posted 09-04-2018 16:52
    Can anyone help me write some crystal code to translate SO_OrderDetail.PromiseDate into a fiscal period according to GL_FiscalYear?


  • 2.  RE: Can anyone help me write some crystal code to tran

    Posted 09-04-2018 17:17
    If fiscal is based on calendar months, you can use this: month({SO_SalesOrderDetail.PromiseDate})


  • 3.  RE: Can anyone help me write some crystal code to tran

    Posted 09-04-2018 17:33
    Unfortunately it's not and it changes every year.


  • 4.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 11:38
    Create a subreport with GL_FiscalYearDetail and pass the Promise Date into it. In the selection formula in the subreport enter something like {?Pm-SO_SalesOrderDetail.PromiseDate}<={GL_FiscalYearDetail.PeriodEndingDate}. This will give you all of the Fiscal Year Detail records after (or equal to) the promise date. Summarize the minimum fiscal period on the report footer, and hide everything else.


  • 5.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 11:46
    As I think about this more I am guessing it will not be possible - because it is an export. Any subreports will mess up the format of the excel file and I don't think it will be possible to derive the fiscal period in a single formula field.


  • 6.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 11:50
    You could create a script to populate a UDF with this value.


  • 7.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 11:56
    @MichaelNottoli that's a thought.


  • 8.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 14:01
      |   view attached
    You can get it with a subreport. I can't say it's elegant.

    Attachment(s)

    rpt
    Get_Fiscal_Period.rpt   53 KB 1 version


  • 9.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 15:56
    @RobertWood but can I export it to Excel and keep the data in neat rows and columns?


  • 10.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 16:23
    Can you use 2016 Excel Power Query instead of Crystal?


  • 11.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 17:12
    @DanBurleson I don't know. The query is actually just a dump of SO_SalesOrderDetail & Header except for the fiscal period and some simple filters, so maybe - talk to me!


  • 12.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 17:13
      |   view attached
    @GregStiles if you use this version and export it to Excel (Not the Data Only version), it seems to work.

    Attachment(s)

    rpt
    Get_Fiscal_Period.rpt   53 KB 1 version


  • 13.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 19:07
      |   view attached
    Awesome @RobertWood but why do you think these particular dates are causing the year and period to be blank?


  • 14.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 19:20
      |   view attached
    @GregStiles mostly because I cobbled it together in about 15 minutes and didn't double check my logic. I left a = sign out so if the date was a period end date, it returned a blank. In the subreport, you'd need to change the suppress logic on the details section. Here's an updated report.

    Attachment(s)

    rpt
    Get_Fiscal_Period.rpt   53 KB 1 version


  • 15.  RE: Can anyone help me write some crystal code to tran

    Posted 09-05-2018 19:37
    @RobertWood fantastic! I'll insert this into my report and see how it goes - thanks!


  • 16.  RE: Can anyone help me write some crystal code to tran

    Posted 09-06-2018 06:17
    If it doesn't export to Excel well, I know a technique which might help.


  • 17.  RE: Can anyone help me write some crystal code to tran

    Posted 09-06-2018 07:23
    @KevinMoyes it does, but I would still like to know your technique?


  • 18.  RE: Can anyone help me write some crystal code to tran

    Posted 09-06-2018 07:29
    I've had success with exports of crystal with subreports for use in excel by exporting as tab delimited file.


  • 19.  RE: Can anyone help me write some crystal code to tran

    Posted 09-06-2018 07:33
    Pass the value to the main report using a shared / global variable. Put the sub-report in the section above, but don't fully suppress it. Have the value calculated in the sub-report within a ""hidden"" section (with everything else suppressed in the sub report). Sub-report formatting: suppress blank sub report. Main report section formatting: suppress blank section. This way the sub-report is executed (so the shared variable is calculated properly), but produces no output. Because you are bringing out the shared value in a normal main report formula field, it should export to Excel nicely.


  • 20.  RE: Can anyone help me write some crystal code to tran

    Posted 09-06-2018 09:09
      |   view attached
    Here's a quick 5 minute example, using Robert's report as a starting point.

    Attachment(s)

    rpt
    Get_Fiscal_Period(1).rpt   52 KB 1 version


  • 21.  RE: Can anyone help me write some crystal code to tran

    Posted 09-06-2018 10:00
    That's cool, @KevinMoyes!


  • 22.  RE: Can anyone help me write some crystal code to tran

    Posted 09-06-2018 16:46
    @KevinMoyes that is cool!


  • 23.  RE: Can anyone help me write some crystal code to tran

    Posted 09-06-2018 21:22
      |   view attached
    Linking solution: No code, no sub reports, no variables needed

    Attachment(s)



  • 24.  RE: Can anyone help me write some crystal code to tran

    Posted 09-07-2018 07:11
    Sweet. That is why this group is so helpful!


  • 25.  RE: Can anyone help me write some crystal code to tran

    Posted 09-07-2018 08:42
    @DanBurleson WOW, wow, excellent!


  • 26.  RE: Can anyone help me write some crystal code to tran

    Posted 09-07-2018 08:50
    Yes, a very nice technique @DanBurleson . For a report with simple grouping I think I'll start using that! It never occurred to me to use the <= type join for this! I had to come up with something for complex reports, needing sub-report data in the main report for math... and after I came up with the method above I tend to use it whenever I need results with odd linking, but sub-reports do add processing time. Adding another tool to the tool kit is always welcome!


  • 27.  RE: Can anyone help me write some crystal code to tran

    Posted 09-11-2018 19:30
    Sure if you want to do it the smart way, @DanBurleson. :laughing:


  • 28.  RE: Can anyone help me write some crystal code to tran

    Posted 09-11-2018 20:14
    A ""simple way"" is a beautiful thing!