COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Sus on 19 Oct 2016 08:10:17 AM

Title: THE "IF" NOT PROPERLY RESOLVED
Post by: Sus on 19 Oct 2016 08:10:17 AM
Hello, i have a problema with if sentece in Report Studio.
In DB data they are as follows:
 
episodio   Num_urgencia  NUM_UG_CON_INGRESO     NUM_UG_SIN_INGRESO  HORAS_DURACION_URGENCIA
   1                     1                         1                                          0                                                 5
   2                     1                         0                                          1                                                 3
   3                     1                         0                                          1                                                 5
   4                     1                         0                                          1                                                 6
   5                     1                         0                                          1                                                 2

I want to get the emergency number without income 4 hours have passed and it created a data item with the following if:
if (HORAS_DURACION_URGENCIA> 4) then (NUM_URG_SIN_INGRESO) else (0) -> this with the data above should give me 2

The problem is that you are returning me 4 being the total NUM_UG_SIN_INGRESO and  gives me the impression that it is because I is adding the total number of hours of urgency, and of course me exceed 4 and returns the total of NUM_UG_SIN_INGRESO.

Do you have any idea why he is behaving like this?

Thank you very much.






Title: Re: THE "IF" NOT PROPERLY RESOLVED
Post by: MFGF on 19 Oct 2016 10:23:16 AM
Quote from: Sus on 19 Oct 2016 08:10:17 AM
Hello, i have a problema with if sentece in Report Studio.
In DB data they are as follows:
 
episodio   Num_urgencia  NUM_UG_CON_INGRESO     NUM_UG_SIN_INGRESO  HORAS_DURACION_URGENCIA
   1                     1                         1                                          0                                                 5
   2                     1                         0                                          1                                                 3
   3                     1                         0                                          1                                                 5
   4                     1                         0                                          1                                                 6
   5                     1                         0                                          1                                                 2

I want to get the emergency number without income 4 hours have passed and it created a data item with the following if:
if (HORAS_DURACION_URGENCIA> 4) then (NUM_URG_SIN_INGRESO) else (0) -> this with the data above should give me 2

The problem is that you are returning me 4 being the total NUM_UG_SIN_INGRESO and  gives me the impression that it is because I is adding the total number of hours of urgency, and of course me exceed 4 and returns the total of NUM_UG_SIN_INGRESO.

Do you have any idea why he is behaving like this?

Thank you very much.

So this is a query calculation? Can you be specific about the syntax you used. Was it

if ([HORAS_DURACION_URGENCIA] > 4) then ([NUM_URG_SIN_INGRESO]) else (0)

or was it

if ([your package].[your query subject].[HORAS_DURACION_URGENCIA] > 4) then ([your package].[your query subject].[NUM_URG_SIN_INGRESO]) else (0)

The former applies if you brought in the items from the query, and the latter applies if you brought in the items from the package.

The difference between the two is the timing of the calculation. The former is applied after the default aggregation occurs. The latter is applied before the default aggregation occurs. I think this is what you need here?

Regards,

MF.
Title: Re: THE "IF" NOT PROPERLY RESOLVED
Post by: Sus on 20 Oct 2016 04:38:56 AM
Thank's !!! it is the solution!!