Mon Oct 25, 2021 11:23 pm
Login Register Lost Password? Contact Us


how to Use OUTPUT (for Appending)

Topics specific to the use of the ECL IDE

Fri Jan 06, 2012 1:44 pm Change Time Zone

Hi,
We are facing problem while using OUTPUT, we want to use some keyword in OUTPUT so that we can append the new result in alresdy exsisting dataset.
Is there any Keyword for Appending in OUTPUT.
Apurv.Khare
 
Posts: 30
Joined: Fri Jan 06, 2012 1:30 pm

Fri Jan 06, 2012 2:21 pm Change Time Zone

This question will be better answered in the "ECL" Forum (this forum is more for IDE queries).

While I don't think there is anyway to append data to an existing file on disk, you can use the "+" operator with tables + datasets:
Code: Select all
d1 := dataset(...orig results...)

d2 := dataset(...new results...)

d3 := d1 + d2 //record struct will have to match!

output(d3);


HTH,

Gordon.
gsmith
 
Posts: 290
Joined: Thu May 12, 2011 9:40 am

Fri Jan 06, 2012 9:54 pm Change Time Zone

Look at he section of the OUTPUT documentation that discusses the NAMED option, which also allows you to use the EXTEND option as in this example:

Code: Select all
//a NAMED, EXTEND example:
errMsgRec := RECORD
  UNSIGNED4 code;
  STRING text;
END;
makeErrMsg(UNSIGNED4 _code,STRING _text) := DATASET([{_code, _text}], errMsgRec);

rptErrMsg(UNSIGNED4 _code,STRING _text) :=
                     OUTPUT(makeErrMsg(_code,_text),NAMED('ErrorResult'),EXTEND);

OUTPUT(DATASET([{100, 'Failed'}],errMsgRec),NAMED('ErrorResult'),EXTEND);
      //Explicit syntax.

//Something else creates the dataset
OUTPUT(makeErrMsg(101, 'Failed again'),NAMED('ErrorResult'),EXTEND);
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1600
Joined: Wed Oct 26, 2011 7:40 pm


Return to ECL IDE

Who is online

Users browsing this forum: No registered users and 1 guest

cron