OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM Create custom "function" in OroCRM Reports?

This topic contains 3 replies, has 2 voices, and was last updated by  spyout98 5 years, 12 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #30862

    spyout98
    Participant

    On OroCRM Reports page, I can create some reports with these following options for “function” field (see image below):

    report

    But, sometimes (for example), I have to create reports that makes, in SQL, COUNT(*) in many rows that can be duplicated (because of a JOIN or a GROUP BY clause or something like this). So, I want to make “DISTINCT” COUNT, or DISTINCT SUM, AVG, MAX and so on.

    How do I do that in OroCRM Report? Because currently there is a options for “DISTINCT COUNT”, “DISTINCT SUM” and so on. I want to make DISTINCT in results before agregate them in a COUNT, AVG or SUM sql operator.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #30863

    vsoroka
    Moderator

    Hello spyout98,

    please take a look at Oro/Bundle/ReportBundle/Resources/config/oro/query_designer.yml and then Oro/Bundle/ReportBundle/Resources/translations/messages.en.yml.

    To create new functions you need to add Resources/config/oro/query_designer.yml in any of your bundle and declare the functions there. Also you need to create translations for names and hints of the functions.

    Here is Resources/config/oro/query_designer.yml for your case:

    and Resources/translations/messages.en.yml:

    #30864

    spyout98
    Participant

    Thank you so much, man! It Worked very well here.

    I’ve created an issue and a simple pull request in Github repository of OroPlatform. Please, check it there, because it adds a simple (and great!) feature for the community of OroPlatform. For advanced reports, this feature is indispensable!

    Here is the links:

    https://github.com/oroinc/platform/issues/825
    https://github.com/oroinc/platform/pull/824

    #30865

    spyout98
    Participant

    vsoroka,

    Please, send me a feedback about the pull request as soon as possible. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

The forum ‘OroCRM’ is closed to new topics and replies.

Back to top