ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 6 replies, has 2 voices, and was last updated by Madhur Madhur 1 year, 8 months ago.

  • Creator
    Topic
  • #16484
    Madhur
    Madhur
    Participant

    Hi,

    I want to show the context record for a Calendar Event in the Datagrid.

    Is it possible? I can see that the information is stored in relation tables named as ‘oro_rel_dj73yejkd98’ or something like that. How can I make a join to this table? Is there any entity / class that is associated with this table? Because in the Datagrid only ORM datasource is implemented so I cannot give a table name directly in the joins.

    So how can I show the context information in a datagrid? This is for one of my reports.

    Please let me know urgently as the customer is waiting for this report.

    I basically want to show the following fields in one report:

    Business Unit, Username, Account Name (context), Calendar Event Title, Time of meeting, (and some custom fields)

    The custom fields capture the information whether they have attended the meeting or not.

    The other way I can think of is directly make calls to the database in the controller by running SQL queries and sending the resultset array to a twig file and show the information in a table. But I would not be able to show filters and coding all those things will take lot of time. And also I would lose the responsive feature.

    Please advise how can I go ahead with this requirement. Please help.

    Thanks and Regards,
    Madhur

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #16485
    Madhur
    Madhur
    Participant

    This is my code for the datagrid report. I am getting error because of the oro_rel_46a29d19b28b6f386b70ee table join.

    I want to show the Context Account Name and some other custom fields from Account Entity. Can someone please tell me how to do it?

    #16486
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello.

    oro_rel_46a29d19b28b6f386b70ee is not a parameter, it’s intersection table name of the many-to-many relation. If you want to join entity from activity (like CalendarEvent) you should use relation name, not table name. You can get list of the available relations from the entity metadata.

    #16493
    Madhur
    Madhur
    Participant

    Hi Yevhen,

    Thanks for the response. But where can I find the list of relations for the entity metadata?

    I searched in the oro_entity_config_field table for the CalendarEvent entity. I found there a many to many relation field with Account with the name account_89f0f6f. I tried replacing the oro_rel_46a29d19b28b6f386b70ee with this, but still its giving me the same error.

    Can you please guide me how to get the list of relations for an entity and how to use it in the datagird?

    Thanks and regards,
    Madhur

    #16494
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    > I found there a many to many relation field with Account with the name account_89f0f6f
    That look’s like relation name – you can use it as any other relation. Here is example, just check if you need additional condition or not.

    #16797
    Madhur
    Madhur
    Participant

    Hi Yevhen,

    This worked beautifully. Initially I had to rack my brains to find out how the sql queries are created based on what I choose in the join list. but finally I was able to get it.

    Great work. Thanks and Lot.

    Regards,
    Madhur

    #16798
    Madhur
    Madhur
    Participant

    For others who want to know how it was done, please look at the code and explanation below:

    I was not getting what object the cntxt would be. I thought it would give me the relation table columns. But instead, it actually becomes the entity with whom the calendar event is related to. So in this code, the cntxt object actually got converted to the Account Entity. So I could easily use the Account entity columns to show and join with other tables.

    So this is how it turned out. Took a little time to understand, but I feel this is the best way to implement it.

    Thanks.

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

You must be logged in to reply to this topic.