Announcement

Collapse
No announcement yet.

how to configure formula for date format "Quartal"?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • bansalrehana
    replied
    hello,

    Thank you so much for sharing this helpful information, it helped me alot

    Thanks and regards. 9apps cartoonhd
    Last edited by bansalrehana; 09-30-2020, 08:36 AM.

    Leave a comment:


  • gustavgraz
    replied
    Hi yurikuzn!

    Now it works, thanks so much!

    Leave a comment:


  • yuri
    commented on 's reply
    Check my post above.

  • gustavgraz
    replied
    Hi Maximus!

    great advice, now it works as a first step.


    The output in field "quartal" is for example "3".

    I need "3. Quartal 2020"

    So now I added string\concatenate in this way:

    quartal = string\concatenate
    (number\floor(
    datetime\month(
    entity\attribute('datum')
    ) / 4
    ) + 1,'. Quartal ','year');

    The result:
    "3. Quartal year"

    I need "3. Quartal 2020"

    Is there a way to do it?

    Thank you!

    Leave a comment:


  • yuri
    replied
    Code:
    
    $quarter = number\floor(
      datetime\month(
        entity\attribute('datum')
      ) / 4
    ) + 1;
    
    $quarterString = string\concatenate(
      $quarter,
      '. Quartal ',
      datetime\year(
        entity\attribute('datum')
      )
    );
    
    entity\setAttribute('quartal', $quarterString);
    Last edited by yuri; 09-16-2020, 08:59 AM.

    Leave a comment:


  • yuri
    commented on 's reply
    A forgot division. Edited the formula above.

  • Maximus
    replied
    Hi gustav,
    in formula 'entity\attribute()' you don't need to replace 'entity' with 'EigenkontrolleBrandschutztueren'. It is constant value, so it should be as in the Yuri's example.
    Also, replace '$quartal' with 'quartal' in ypur formula
    Last edited by Maximus; 09-16-2020, 08:45 AM.

    Leave a comment:


  • gustavgraz
    replied
    Hello yurikuzn!

    appreciate your suggestion of a code!

    So what I am doing:

    Code:
    $quartal = number\floor(
    datetime\month(
    EigenkontrolleBrandschutztueren\attribute('datum')
    )
    ) + 1;


    EigenkontrolleBrandschutztueren = custom entity
    quartal = vachar field in entity EigenkontrolleBrandschutztueren
    datum = date field in entity EigenkontrolleBrandschutztueren where the user enters the date

    I dont know what in this case attribute is, I took the field name again "quartal"

    Unfortunately does not work!
    Last edited by gustavgraz; 09-16-2020, 08:22 AM.

    Leave a comment:


  • yuri
    replied
    Hi,

    You can divide a month number by 4, floor it then add 1.

    Code:
    $quarter = number\floor(
      datetime\month(
        entity\attribute('dateFieldName')
      ) / 4
    ) + 1;
    Last edited by yuri; 09-16-2020, 08:53 AM.

    Leave a comment:


  • how to configure formula for date format "Quartal"?

    Advanced Pack 2.5.14
    EspoCRM Version 5.9.3

    Hello!

    I am building a custom entity where I need a "quarterly" date format.

    So if the record has a date field 25.02.2020, there shall be a second date field which is autofilled with "1. Quartal 2020"

    I think that this feature should be realised with a formula in the custom entity. But I am not good enough in formulas...

    something like:

    if field "date" is between 01.01.2020 and 30.03.2020 then field "quartal" is "1. Quartal 2020"
    and
    if field "date" is between 01.04.2020 and 30.06.2020 then field "quartal" is "2. Quartal 2020"
    and
    if field "date" is between 01.07.2020 and 30.09.2020 then field "quartal" is "3. Quartal 2020"
    and
    if field "date" is between 01.10.2020 and 31.12.2020 then field "quartal" is "4. Quartal 2020"

    How can this be formulated in a correct working way?

    Thank you!
Working...
X