Announcement

Collapse
No announcement yet.

Setting Up Max Sequence

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting Up Max Sequence

    hi

    I am trying to set a max sequence for a dataset and the method that i followed is as follows. it works fine, but i was wondering if there is any easier way to do this.



    dcl object f info;
    f=_self_.frameid;
    f._getNumVar('recordInfo',info);

    dcl num curseq = info.currentSeqValue;
    dcl num maxSequence = 9;

    if curseq > maxSequence then do;
    rcc=messagebox({'max sequence for this dataset is 3'}); rcc=rcc;
    call execcmd('SEQUENCELEFT');
    return;
    end;





    thanks.
    __________________
    Bhagya Gurusu



    ________________________________________________________________

    If you only want to check that the current value is not greater than a specific value, you can reference the sequence object that holds the current value for the record.




    if sequence.text > 3 then do;
    rcc=messagebox({'max sequence for this dataset is 3'}); rcc=rcc;
    call execcmd('SEQUENCELEFT');
    return;
    end;



    The only problem with this method is that it will only work at the end of the group of sequences. A user could potentially insert a seqence in the middle causing there to be more than the desired number.

    In my post, Setting a field value based on the Sequence I reference the recordinfo object to get the list of sequences and then check to see if there number of items in the list is already at the max, thereby not allowing them to insert another sequence.
    __________________
    Greg Wagner
    Manager Support and Development
    DZS Software Solutions, Inc.
Working...
X