Customer Portal

dbInputTable no records

Comments 2

  • Avatar
    avackova
    0
    Comment actions Permalink
    Hello dnrickner,
    it can be hacked by adding a Reformat with following code after the DBInputTable:
    //#CTL1
    int counter = 0;
    // Transforms input record into output record.
    function transform() {
    counter++;
    $0.* := $0.*;
    return 0
    }

    function finished(){
    dict_put_str("rec_no",num2str(counter));
    }

    This Reformat just counts the input records and sends them to output port. After all records are processed it puts number of processed records to the dictionary. In the subsequent phase, you can get the value from dictionary and, depending on the value, do A or B, eg. in DataGenerator:
    function generate() {
    int rec_no;
    rec_no = str2num(dict_get_str("rec_no"));
    $field := iif(rec_no == 0, "no records processed", "number of processed records: " + rec_no);
    return 0
    }
  • Avatar
    dnrickner
    0
    Comment actions Permalink
    Thank you. This is working.

Please sign in to leave a comment.