Sun Aug 07, 2022 3:24 pm
Login Register Lost Password? Contact Us

Please Note: The HPCC Systems forums are moving to Stack Overflow. We invite you to post your questions on Stack Overflow utilizing the tag hpcc-ecl (https://stackoverflow.com/search?tab=newest&q=hpcc-ecl). This legacy forum will be active and monitored during our transition to Stack Overflow but will become read only beginning September 1, 2022.



STD.File.FileExists with nothor()

Comments and questions related to the Enterprise Control Language

Thu Apr 18, 2019 10:38 pm Change Time Zone

I am trying to use nothor() for a simple project() .


Here is my code :
----------------------SNIP---------------------------------------------------
global_newSuperfileLink := global(newSuperfileLink);

newSuperfileLinkCheckLogical := nothor(PROJECT(global_newSuperfileLink,
TRANSFORM(superfile_logicalfile_flat_layout,
SELF.LogicalFileExists := STD.File.FileExists(left.LogicalFile),
SELF := left ))) : INDEPENDENT;

Then I use newSuperfileLinkCheckLogical for rest of the processing …..
----------------------SNIP---------------------------------------------------


This gives me an error : Error: INTERNAL: Expected a parent/container context. Likely to be caused by executing something invalid inside a NOTHOR. (0, 0), 4818,

I just want to check and record if those files actually exist.
rati
 
Posts: 4
Joined: Wed Oct 23, 2013 2:51 pm

Fri Apr 19, 2019 4:32 pm Change Time Zone

rati,

There is no inherent problem with using STD.File.FileExists inside a NOTHOR. I just tested this code on one of our training clusters and it ran fine:
Code: Select all
import Std;
LogicalFile := '~CLASS::RT::Intro::Persons';
NOTHOR(STD.File.FileExists(LogicalFile));
So your problem is not with that function per se. This code also works correctly:
Code: Select all
import Std;
ds := DATASET([{'~CLASS::RT::Intro::Persons'},
               {'~CLASS::RT::Intro::Accounts'},
               {'~CLASS::RT::Intro::NoFileForThis'}
              ],{STRING LogicalFile});

nothor(PROJECT(ds,
                TRANSFORM({BOOLEAN LogicalFileExists,STRING LogicalFile},
                          SELF.LogicalFileExists := STD.File.FileExists(left.LogicalFile),
                          SELF := left ))) : INDEPENDENT;

Perhaps it's an interaction with your use of the GLOBAL function?

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1619
Joined: Wed Oct 26, 2011 7:40 pm

Tue Apr 23, 2019 3:13 pm Change Time Zone

Adding few to global() helped.

Code: Select all
global_newSuperfileLink := global(newSuperfileLink,few);
rati
 
Posts: 4
Joined: Wed Oct 23, 2013 2:51 pm


Return to ECL

Who is online

Users browsing this forum: No registered users and 1 guest

cron