Simple List with Birthdays

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ChrisL
    Member
    • Dec 2017
    • 46

    Simple List with Birthdays

    HI all,

    I'm trying to create a simple report with a list of the Contacts Birhtdays.

    I would like, that the Report is ordered by the next upcoming Birthdays.

    Actually I have the issue, that I can only display the full date of Birth, and if I sort after that, it sorts obviously from the age...

    thx for help



  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    have you read https://www.espocrm.com/blog/report-...have-birthday/


    With sorting there is a problem. I think it could be implemented with development
    an example, but for float value
    There is an entity having 2 float fields, A & B how can i set the filter of the report to show record which value of field A is greater than that of field B?

    you can create not storable field, {currentYear-BirthMonth -BirthDay}

    Comment

    • ChrisL
      Member
      • Dec 2017
      • 46

      #3
      Hi Tanya,

      yes, we have read the blog report and already tried to play around with it, unfortunately with now success... (as do not need to see for this case the Birthdays today, tomorrow or in this month - we will need this for a reminder email via a workflow!)

      We would only like to have a list, sorted by Birthdays trough they year (it's also ok, if this list always starts with January and not the actual month/day!)
      so first field - months - January to December
      second sorting field - days, 1-31

      We could theoretically achieve this quite easy, if the fields "day" "month" "year" are all single fields, but it would be a shame, not to use date field for that..., you agree?

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        the third way, I wrote
        This is part of custom/Espo/Custom/Resources/metadata/entityDefs/Contact.json fields section
        "birthday": {
        "notNull": false,
        "type": "date",
        "required": false,
        "isPersonalData": true,
        "audited": false,
        "readOnly": false,
        "tooltip": false,
        "isCustom": true
        },
        "thisYearBirthday": {
        "notStorable": true,
        "type": "varchar",
        "required": false,
        "readOnly": true,
        "isCustom": true,
        "select": "DATE_FORMAT(contact.birthday, '2018-%m-%d')",
        "orderBy": "thisYearBirthday {direction}"
        },

        In contact entity, that's why you see contact in select.

        This field is not filterable, but it is sortable.
        After checking whether json is valid, Administration > Rebuild

        Comment

        • ChrisL
          Member
          • Dec 2017
          • 46

          #5
          just for my understaind, I need to add this code to the contact.json file at the end, to the "fields"? correct?

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            it hasn't metter, at the end or at the start. It has to be in "fields" section in custom/Espo/Custom/Resources/metadata/entityDefs/Contact.json
            If you want, you can share your file and I will show you the needed place

            Comment

            • MicKress
              Senior Member
              • Aug 2017
              • 105

              #7
              Hi Tanya, would it be possible to create a notstorable field for age?

              Comment

              • tanya
                Senior Member
                • Jun 2014
                • 4308

                #8
                Hello,
                of course, you can create notStorable field for age.

                Comment

                • MicKress
                  Senior Member
                  • Aug 2017
                  • 105

                  #9
                  So I write „datetime\diff(datetime\today(), birthday, 'years')“ in the select statement in the above code?

                  Comment

                  • tanya
                    Senior Member
                    • Jun 2014
                    • 4308

                    #10
                    if you want to make it notStorable, but with calculated value, better to set calculation in entityDefs in "select"

                    Comment

                    • MicKress
                      Senior Member
                      • Aug 2017
                      • 105

                      #11
                      Do you mean in contact.json in entityDefs?

                      Comment

                      • tanya
                        Senior Member
                        • Jun 2014
                        • 4308

                        #12
                        yes,
                        check the post #4 in this topic

                        Comment

                        Working...