Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Numeric.sequence with Long

Good Morning,

 

I want to create a sequence which can go until 9999999999 which is actually over the int limit.

 

I tried to pass a Long value to this dedicated Talend function "Numeric.sequence()", but it appears to be not implemented.

It needs an int and it works if I submit my variable applying intValue(), but it has side effects : it doesn't increment properly at a certain point.

 

How can I go until this top value of "9 999 999 999" ?

 

Thank You.

 

note : I'm using Talend Real-Time Big Data  Platform 6.2.1 with a Talend Administration Console to launch the jobs.

 

 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

You can easily implement this yourself. Go to Code--> Routines-->system in your project tree and find the Numeric routine. Take a look in there for the sequence method. Simply copy this and convert it to use Long in your own routine.

View solution in original post

5 Replies
Anonymous
Not applicable
Author

You can easily implement this yourself. Go to Code--> Routines-->system in your project tree and find the Numeric routine. Take a look in there for the sequence method. Simply copy this and convert it to use Long in your own routine.

Anonymous
Not applicable
Author

Thank You.

 

I'll do that as it seems to be the best way to achieve this until Talend implement it 0683p000009MACn.png

Anonymous
Not applicable
Author

To be honest, I think the routines that Talend supply are more a useful example of what you can do. I wouldn't expect them to update these too often. It is very useful to build up your own routines (classes) of useful functionality.

Anonymous
Not applicable
Author

I think You're right, but we tend to use Talend bundled components and routines.

 

Then there is less specific developments to maintain.

 

By the way, there is the code I've adapted in case it could be useful to anyone :


 

private static final java.util.Map<String, Long> seq_Hash = new java.util.HashMap<String, Long>();
      public static Long LongSequence(String seqName, Long startValue, int step) {
        if (seq_Hash.containsKey(seqName)) {
            seq_Hash.put(seqName, seq_Hash.get(seqName) + step);
                  if(seq_Hash.get(seqName)>9999999999L){
                        seq_Hash.put(seqName, 0L);
                  }
            return seq_Hash.get(seqName);
        } else {
            seq_Hash.put(seqName, startValue);
            return startValue;
        }
    }

 

Anonymous
Not applicable
Author

@Jacky_Siveton you have left a couple of method out that you *might* need....

 

    /**
     * create a sequence if not exists and put a new startValue
     *
     * {Category} Numeric
     *
     * {param} string("s1") sequence identifier
     *
     * {param} long(1) start value
     *
     * {example} sequence("s1", 1)
     *
     */

    public static void resetSequence(String seqName, long startValue) {
        seq_Hash.put(seqName, startValue);
    }

    /**
     * remove a sequence
     *
     * {Category} Numeric
     *
     * {param} string("s1") sequence identifier
     *
     * {example} sequence("s1")
     *
     */

    public static void removeSequence(String seqName) {
        if (seq_Hash.containsKey(seqName)) {
            seq_Hash.remove(seqName);
        }
    }