Thu Aug 16, 2018 6:57 am
Login Register Lost Password? Contact Us


Use of ROW

Comments and questions related to the Enterprise Control Language

Thu Nov 30, 2017 4:07 am Change Time Zone

I have a statement like
Code: Select all
   %HoldL_CNPNAME_zipcan% := %ToProcess%(~BizLinkFull.Key_BizHead_L_CNPNAME_ZIP.CanSearch(ROW(%ToProcess%)));
;


where %ToProcess% is a dataset and CanSearch is an attribute in module defined as
Code: Select all
EXPORT CanSearch(Process_Biz_Layouts.InputLayout le) := le.cnp_name <> (TYPEOF(le.cnp_name))'' AND Fields.InValid_cnp_name((SALT37.StrType)le.cnp_name)=0 AND EXISTS(le.zip_cases);


This works fine. But I don't really understand what it's doing, so I try to break it down.
Code: Select all
%HoldL_CNPNAME_ziprow% := ROW(%ToProcess%);

This gives me an error: Error: ROW(PROJECT(sf, sb(LEFT)...) - dataset argument is not in scope. Did you mean dataset[1]?

What is causing the error?
There are 3 forms listed in the language reference for ROW, and this doesn't appear to be following any of them. How is it even working before I try to break down the statement?
The attribute CanSearch takes a parameter, but it's not a function or a macro. What is it?
janet.anderson
 
Posts: 29
Joined: Wed Jul 17, 2013 5:31 pm

Fri Dec 01, 2017 3:54 pm Change Time Zone

What is causing the error?
There are 3 forms listed in the language reference for ROW, and this doesn't appear to be following any of them. How is it even working before I try to break down the statement?
The attribute CanSearch takes a parameter, but it's not a function or a macro. What is it?


CanSearch looks like a BOOLEAN function to me, based on the expression.

ROW is looking for a single record input, and it looks like you are providing a whole recordset. Hence the message DATASET[1], which would return a single record and satisfy the ROW requirement.

Regards,

Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 975
Joined: Wed Jun 29, 2011 7:13 pm

Fri Dec 01, 2017 4:56 pm Change Time Zone

Why does an function like CanSearch not require a RETURN statement?

Since the full statement
Code: Select all
%HoldL_CNPNAME_zipcan% := %ToProcess%(~BizLinkFull.Key_BizHead_L_CNPNAME_ZIP.CanSearch(ROW(%ToProcess%)));

does not give an error, and here ROW is also taking the dataset %ToProcess%, then why would it give me an error when I want to break it down and look at only
Code: Select all
%HoldL_CNPNAME_ziprow% := ROW(%ToProcess%);


To see an example, look at Dataland WU W20171201-114948: lines 367-372 are commented out and the code runs. W20171201-114953 the job fails when the line when I uncomment these lines.
janet.anderson
 
Posts: 29
Joined: Wed Jul 17, 2013 5:31 pm

Fri Dec 01, 2017 5:29 pm Change Time Zone

Janet,

Any definition that passes parameters is an ECL function, and what is "return"ed is the result of the expression, but there is also a FUNCTION structure that allows you to encapsulate code and RETURN a specific value.

Regarding the ROW usage, since it is inline with a recordset filter, the compiler knows in that case to read a single record. When you pull it out of the filter, ROW no longer knows which specific record you are referring to, and hence the error.

Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 975
Joined: Wed Jun 29, 2011 7:13 pm

Fri Dec 01, 2017 5:31 pm Change Time Zone

Thanks, Bob.
janet.anderson
 
Posts: 29
Joined: Wed Jul 17, 2013 5:31 pm


Return to ECL

Who is online

Users browsing this forum: No registered users and 1 guest