Author Topic: Similar to Brio  (Read 984 times)

Offline Abhi1

  • Senior Member
  • ****
  • Posts: 67
  • Forum Citizenship: +0/-0
Similar to Brio
« on: 02 Sep 2010 04:34:44 pm »
Hi Everyone,
In Brio we have a function called Prior(). Is there any function which acts in same manner in Cognos.

Regards,
Ram.

Online MFGF

  • Never knowingly correct
  • Super Moderator
  • Statesman
  • ******
  • Posts: 2,908
  • Forum Citizenship: +137/-1
  • Cognos Software Muppet
Re: Similar to Brio
« Reply #1 on: 02 Sep 2010 05:45:26 pm »
My crystal ball is not functioning today.   ;D
Can you give us at least a tiny clue about what the function does?

MF.
Meep!

Offline PaulM

  • Global Moderator
  • Statesman
  • *****
  • Posts: 586
  • Forum Citizenship: +81/-1
Re: Similar to Brio
« Reply #2 on: 02 Sep 2010 05:53:28 pm »
I loved Brio, especially when you have lots of tracks and bridges and trains. Ahhh, youth.

The prior function would return the value in the previous row of the selected column.


ID | A | B
01 | 1 |
02 | 2 | 1
03 | 3 | 2


and so on.

A running function might work for numeric values, but it's not so useful for text. Can you share what you're trying to achieve?

Offline Abhi1

  • Senior Member
  • ****
  • Posts: 67
  • Forum Citizenship: +0/-0
Re: Similar to Brio
« Reply #3 on: 03 Sep 2010 01:22:05 pm »
Thanks Paul and MFGF.
Well I have a piece of code which was actually developed in BRIO using Prior() function.

if (Emp_Stat_Cd == 'PT' ) { 24}
 if ( Emp_Stat_Cd == 'RG'  || Emp_Stat_Cd == 'TE') { 40}
if (Prior ( Unique_Number )  == Unique_Number) {0}

this functionality , I need to develop in cognos.

Regards,

Ram.

Online MFGF

  • Never knowingly correct
  • Super Moderator
  • Statesman
  • ******
  • Posts: 2,908
  • Forum Citizenship: +137/-1
  • Cognos Software Muppet
Re: Similar to Brio
« Reply #4 on: 03 Sep 2010 04:55:07 pm »
Thanks Paul and MFGF.
Well I have a piece of code which was actually developed in BRIO using Prior() function.

if (Emp_Stat_Cd == 'PT' ) { 24}
 if ( Emp_Stat_Cd == 'RG'  || Emp_Stat_Cd == 'TE') { 40}
if (Prior ( Unique_Number )  == Unique_Number) {0}

this functionality , I need to develop in cognos.

Regards,

Ram.

Sorry - other than Paul (who has a brain the size of a planet!  :)), we don't know much about Brio on these forums.  I can see the code you have posted above, but you haven't explained what it is supposed to do.  We might be able to help if you can tell us what it is you want to do in your report.

MF.
Meep!

Offline PaulM

  • Global Moderator
  • Statesman
  • *****
  • Posts: 586
  • Forum Citizenship: +81/-1
Re: Similar to Brio
« Reply #5 on: 03 Sep 2010 05:06:57 pm »
Brain the size of a planet, and they ask me to play with BRIO Toys...


It's been a few years since I've worked with BRIO. So I might be reading it wrong, but try something like:

case [ns].[Emp_Stat_Cd]
   when 'PT' then 24
   when 'RG' then 40
   when 'TE' then 40
   else
      case
         when moving-total ([ns].[Unique_Number],2) - [ns].[Unique_Number] = [ns].[Unique_Number]
            then 0
            else 1234
      end
end


Offline Abhi1

  • Senior Member
  • ****
  • Posts: 67
  • Forum Citizenship: +0/-0
Re: Similar to Brio
« Reply #6 on: 06 Sep 2010 01:20:31 pm »
Hi Paul,
I have implemented the code as per your guidelines like this
case [ns].[EMP_STAT_CD]
   when 'PT' then 24
   when 'RG' then 40
   when 'TE' then 40
else
case
  when moving-total ([ns].[UNIQUE_NUMBER],2) - [ns].[UNIQUE_NUMBER] = [ns].[UNIQUE_NUMBER]  then 0
            else ([ns].[UNIQUE_NUMBER])
      end
     end
But It is throwing an error saying, Incompatible Case Statement.
« Last Edit: 06 Sep 2010 01:31:23 pm by Abhi Ram »

Offline PaulM

  • Global Moderator
  • Statesman
  • *****
  • Posts: 586
  • Forum Citizenship: +81/-1
Re: Similar to Brio
« Reply #7 on: 06 Sep 2010 02:13:02 pm »
A couple things.

1. Did you copy and paste directly? the [ns] should be replaced with your namespace, (drag the field directly in).

2. Is UNIQUE_NUMBER a numeric field? If not then this method won't work. Look at this post.

If it's neither of those issues, can you give more details on the error thrown?


Offline Abhi1

  • Senior Member
  • ****
  • Posts: 67
  • Forum Citizenship: +0/-0
Re: Similar to Brio
« Reply #8 on: 06 Sep 2010 02:50:45 pm »
Hi Paul,
1)I have not copied the code as it is, In the Forum I have mentioned with ns.
2)UNIQUE_NUMBER Is not a numeric field,It is a string which is like this (107624Ireland2010-01-01)
Regards,
Ram

Offline PaulM

  • Global Moderator
  • Statesman
  • *****
  • Posts: 586
  • Forum Citizenship: +81/-1
Re: Similar to Brio
« Reply #9 on: 06 Sep 2010 04:26:30 pm »
The error was caused by the UNIQUE_NUMBER being a string. In my example I suggested using the moving-total function, which would only work for numeric types.

If you're using Oracle, you can try writing a pure SQL statement in order to use the Lag function. Otherwise you'll have to find another way to handle this, can you think of another way of trying to achieve your goal?

Offline Abhi1

  • Senior Member
  • ****
  • Posts: 67
  • Forum Citizenship: +0/-0
Re: Similar to Brio
« Reply #10 on: 06 Sep 2010 05:03:50 pm »
Hi Paul,
It is a string and we use DB2 Db. And Earlier I have used Lag and Lead()functions to achieve this..

Regards,
Ram

Offline georgia

  • Associate
  • **
  • Posts: 2
  • Forum Citizenship: +0/-0
Re: Similar to Brio
« Reply #11 on: 04 Jul 2011 11:21:10 pm »
Hello,

I know it is been a while but Can you pls tell me if you have found a solution?? I am looking for the same.. In Brio I use the next function to flag if one line is different then the other one..

Offline Abhi1

  • Senior Member
  • ****
  • Posts: 67
  • Forum Citizenship: +0/-0
Re: Similar to Brio
« Reply #12 on: 05 Jul 2011 05:00:21 pm »
Hello Georgia,

I couldn't find any logic for that... till now

Regards,

Ram

Offline georgia

  • Associate
  • **
  • Posts: 2
  • Forum Citizenship: +0/-0
Re: Similar to Brio
« Reply #13 on: 07 Jul 2011 03:01:47 pm »
:(  Thanks anyway :)