OUTPUT module as a dataset
Hi,
I am trying to understand a case where a module could easily be converted to a dataset. The reason why I am trying to do this is that some modules I am working with have 50+ fields, and I would like to be able to have a single output as opposed to 50+ in the ECL IDE or out on the ECL Watch page.
Following is a piece of code I used to test what I am trying to accomplish:
OUTPUT(myModule) produces three outputs - one for each variable, which is kind of undesired. See attachment (outputs).
Is there an easy way to do this without having to define a new layout and projecting everything from the module into a dataset? I thought that doing something like the following would work, but it appears that it doesn't:
I get an error that is exactly at the end of MY_LIBIN, which makes sense and is kind of expected as MY_LIBIN is not a real layout.
Any other insights on how this could easily be achieved would be appreciated.
Thanks.
I am trying to understand a case where a module could easily be converted to a dataset. The reason why I am trying to do this is that some modules I am working with have 50+ fields, and I would like to be able to have a single output as opposed to 50+ in the ECL IDE or out on the ECL Watch page.
Following is a piece of code I used to test what I am trying to accomplish:
- Code: Select all
UNSIGNED firstSettingIn := 2;
MY_LIBIN := INTERFACE
EXPORT UNSIGNED1 firstSetting := 1;
EXPORT UNSIGNED1 secondSetting := 5;
EXPORT BOOLEAN isInternalProduct := TRUE;
END;
myModule := MODULE (MY_LIBIN)
EXPORT UNSIGNED1 firstSetting := firstSettingIn;
END;
OUTPUT(myModule);
OUTPUT(myModule) produces three outputs - one for each variable, which is kind of undesired. See attachment (outputs).
Is there an easy way to do this without having to define a new layout and projecting everything from the module into a dataset? I thought that doing something like the following would work, but it appears that it doesn't:
- Code: Select all
modToDataset := DATASET([TRANSFORM(MY_LIBIN,
SELF.firstSetting := myModule.firstSetting;
SELF := [];)
]);
OUTPUT(modToDataset, NAMED('modToDataset'));
I get an error that is exactly at the end of MY_LIBIN, which makes sense and is kind of expected as MY_LIBIN is not a real layout.
Any other insights on how this could easily be achieved would be appreciated.
Thanks.
- Attachments
-
outputs.jpg
- (21.82 KiB) Not downloaded yet
- flyer
- Posts: 8
- Joined: Fri Dec 11, 2020 1:58 pm
flyer,
In fact, I'm surprised that your OUTPUT(myModule) code works at all. I think you're taking advantage of an undocumented "feature" with that one.
So here's how I would approach the problem:
HTH,
Richard
Short answer: None that I know of (and I tried a couple of ideas before replying).Is there an easy way to do this without having to define a new layout and projecting everything from the module into a dataset?
In fact, I'm surprised that your OUTPUT(myModule) code works at all. I think you're taking advantage of an undocumented "feature" with that one.

So here's how I would approach the problem:
- Code: Select all
UNSIGNED firstSettingIn := 2;
MY_LIBIN := INTERFACE
EXPORT UNSIGNED1 firstSetting := 1;
EXPORT UNSIGNED1 secondSetting := 5;
EXPORT BOOLEAN isInternalProduct := TRUE;
END;
myModule := MODULE (MY_LIBIN)
EXPORT UNSIGNED1 firstSetting := firstSettingIn;
END;
//my suggested solution:
modToDataset(MY_LIBIN i) := FUNCTION
MY_LIBOUT := RECORD
i.firstSetting;
i.secondSetting;
i.isInternalProduct;
END;
ds := DATASET(1,TRANSFORM(MY_LIBOUT,SELF := []));
RETURN TABLE(ds,MY_LIBOUT);
END;
OUTPUT(modToDataset(myModule), NAMED('modToDataset'));
HTH,
Richard
- rtaylor
- Community Advisory Board Member
- Posts: 1619
- Joined: Wed Oct 26, 2011 7:40 pm
Hi Richard,
That is what I thought - to your short answer
In any case, thank you so much for sharing the way you would approach the problem. It is always nice to be exposed to others' ways of thinking.
That is what I thought - to your short answer

In any case, thank you so much for sharing the way you would approach the problem. It is always nice to be exposed to others' ways of thinking.
- flyer
- Posts: 8
- Joined: Fri Dec 11, 2020 1:58 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: Bing [Bot] and 1 guest