Coding modulus (%)

This forum contains ProfileStage posts and now focuses at newer versions Infosphere Information Analyzer.

Moderators: chulett, rschirm

Post Reply
truenorth
Participant
Posts: 139
Joined: Mon Jan 18, 2010 4:59 pm
Location: San Antonio

Coding modulus (%)

Post by truenorth »

I am coding this in a rule logic:

Code: Select all

new_month = no_of_months % 12
In the list of functions, the modulo operator is listed as "%". But with code similar to the above, I am getting this error:

The variable "%" contains an invalid character.

Does anyone know how to code modulus?
Todd Ramirez
Sr Consultant, Data Quality
San Antonio TX
swapnilverma
Participant
Posts: 135
Joined: Tue Aug 14, 2007 4:27 am
Location: Mumbai

Post by swapnilverma »

you can use div or mod functions to achive your desired results.

As per docs % is mainly used for date specification...

may be some one else can put some more light on this ....


but u can definatly use mod function .
Thanks
Swapnil

"Whenever you find whole world against you just turn around and Lead the world"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no modulus operator in Information Analyzer rule definition expressions - you need to use the Mod() function as indicated.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
truenorth
Participant
Posts: 139
Joined: Mon Jan 18, 2010 4:59 pm
Location: San Antonio

Post by truenorth »

I coded

Code: Select all

mod(no_of_months,12)
and got the error "Mod is not a known scalar function."
Todd Ramirez
Sr Consultant, Data Quality
San Antonio TX
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Hmm. Use the functions list (one of the four tabs on the right hand side). You may need to subtract the integer value of the division from the division or some such.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
truenorth
Participant
Posts: 139
Joined: Mon Jan 18, 2010 4:59 pm
Location: San Antonio

Post by truenorth »

Yes, Ray, that's what I ended up doing. IBM should get their act together! And the list of functions is short. I hope they can add more. I can use add_months right now.

Thanks, all.
Todd Ramirez
Sr Consultant, Data Quality
San Antonio TX
Post Reply