MySQL Formula subtraction fails when one of the fields are zero values for version 2.7.2

Post Reply
skalogir
Posts: 6
Joined: 19 Oct 2020, 13:17
Name: Nikos Tatopoulos
Location: Thessaloniki, Greece

MySQL Formula subtraction fails when one of the fields are zero values for version 2.7.2

Post by skalogir »

Hello,

I have a problem with Rukovoditel version 2.7.2 in MySQL Formula. My formula is a simple subtraction of two fields [271]-[272] where field 271 is sum numeric 1 and field 272 is sum numeric 2 and the result goes to final sum where the formula is placed (see attachment). When both fields are non zero values, the formula works fine and I get the result of the subtraction. When one of the fields contains zero, the subtraction never works and the formula gives the empty string (null) as it shown in the attachment.

Now to make things more complicated, the two fields (271 and 272) are sums (MySQL queries) from two DIFFERENT tables A and B (with dynamic calculation enabled). That means field 271 is the sum of all values of a field from table A and field 272 is the sum of all values of a field from table B. When I change my sql query so that both fields (271 and 272) are sums of the values of two different fields from the SAME table C, the formula with the subtraction works fine. Tables A,B and C are on the same level (they are not parent/child) as the table where the formula is placed (table TICKETS as shown in the screenshot). There is an entity field on both tables A and B (non heading, dropdown) which is the ID of the table TICKETS and based on that field the Condition of the mysql query is made so that the sum can be calculated for fields 271 and 272. We can have many records with the same Ticket ID on both tables A and B, but only one record with the same Ticket ID for the table TICKETS (one to many relationship).

This seems like a bug to me. If you need more information I can provide the details of the mysql queries for each of the fields 271 and 272 as well as the contents of the associated tables A and B. Can you please check this issue and let me know if it is indeed a bug, or if there is some issue in my logic?

Thanks in advance.
Attachments
final sum = sum numeric 1 - sum numeric 2
final sum = sum numeric 1 - sum numeric 2
enishemed
Posts: 653
Joined: 30 Oct 2017, 11:24
Name: Enis Hemedoglu
Location: Istanbul, Turkey
Company Name: SCORE DANISMANLIK
Contact:

Re: MySQL Formula subtraction fails when one of the fields are zero values for version 2.7.2

Post by enishemed »

Use the following formula,

IFNULL([271],0) - IFNULL([272],0)
skalogir
Posts: 6
Joined: 19 Oct 2020, 13:17
Name: Nikos Tatopoulos
Location: Thessaloniki, Greece

Re: MySQL Formula subtraction fails when one of the fields are zero values for version 2.7.2

Post by skalogir »

It worked! Thanks
Post Reply