Announcement

Collapse
No announcement yet.

Formula Help of if then

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

  • Formula Help of if then

    Hello,

    I'm trying to figure out below formula to work. Sum related formula is working perfectly. And with that I want to update the Sum Related record created on current month. So I tried with below formula and it didn't work.

    Code:
    ifThen (
    supply_dispatch.createdAt== datetime\month(),
    totalIssue = entity\sumRelated('supplyDispatchs', 'supply_dispatch.dispatchingUnits')
    );
    Appreciate your support to sort this matter.
    Cheers!
    Nishan.

  • #2
    Hi, I think the second argument is not right.
    Without knowing your relationship name I guess:

    - supplyDispatchs is the relationship Link name
    - in the second argument you only should insert the related field name, not the relationship name again, so in my opinion dispatchingUnits would be enough.

    Comment


    • #3
      Hi,
      try this:
      Code:
      ifThen (
          datetime\month(supply_dispatch.createdAt) == datetime\month(datetime\today()) ,
          totalIssue = entity\sumRelated('supplyDispatchs', 'supply_dispatch.dispatchingUnits')
      );

      Comment


      • #4
        Maximus Thank you for the reply. I tried given code and it doesn't work. But below code worked with datetime\today()

        Code:
        ifThen ([INDENT]datetime\today('supply_dispatch.createdAt') == datetime\today(datetime\today()) ,[/INDENT][INDENT]totalIssue = entity\sumRelated('supplyDispatchs', 'supply_dispatch.dispatchingUnits')[/INDENT]
         );

        What I want with this is to update totalIssue if supply_dispatch.createdAt on current month.
        Cheers!
        Nishan.

        Comment


        • #5
          I've solved the formula, this works perfectly. Thank you for your great support Maximus as always.

          Code:
          ifThen ([INDENT]datetime\month('supply_dispatch.createdAt') == datetime\month('datetime\today()'),[/INDENT][INDENT]totalIssue = entity\sumRelated('supplyDispatchs', 'supply_dispatch.dispatchingUnits')[/INDENT]
           
          
           );
          Cheers!
          Nishan.

          Comment

          Working...
          X