You need to sign in to do that
Don't have an account?

dependentPicklistSample error: no viable alternative at character '%'
I have copied the Bitset class from the dependent picklist sample code (bottom of page) into an extension class.
I get the error on the line indicated below.
class Bitset { byte[] data; public Bitset(byte[] data) { this.data = data == null ? new byte[0] : data; } public boolean testBit(int n) { return (data[n >> 3] & (0x80 >> n % 8)) != 0; //error reported on this line } public int size() { return data.length * 8; } }
Any ideas as to what could be wrong?
FYI I'm looking at this code because I have a requirement to conditionally display dependent picklist values in a table instead of using the standard selectLists.
Oops just noticed that's java code...
Looks like to use this in an controller I would need to figure out apex equivalents for byte, %, etc
Anyone done this before?
You have to use "math.mod(i, j)" instead of i%j.