Sun Oct 25, 2020 11:05 am
Login Register Lost Password? Contact Us


DICTIONARY and lookup of DATASETS

Comments and questions related to the Enterprise Control Language

Mon Apr 06, 2020 5:11 pm Change Time Zone

Hi,
This may be documented but I see strange behaviour in DICTIONARY when the item looked up is a DATASET.
Firstly when syntax checking:
Code: Select all
RR := RECORD
    UNSIGNED2        AttributeID;
    UNSIGNED2        BoundaryType;
    DATASET({STRING itm})  BoundaryTexts;
END;

d := DATASET([{1,55,DATASET([{'aaa'},{'bbb'}],{STRING itm})}],RR);

dtype := DICTIONARY(d,{AttributeID => BoundaryType});
dText := DICTIONARY(d,{AttributeID => BoundaryTexts});

dtype[1].BoundaryType;
dText[1].BoundaryTexts;

Returns error:
Code: Select all
Error:    Unknown identifier "BoundaryTexts" (13, 10), 2167,

Now I know the field qualifier is not needed in this instance but its still been allowed for 'BoundaryType'.

Now if I remove the unnecessary field qualifiers thus:
Code: Select all
dtype[1];
dText[1];

access of 'dtype' works, but the access of 'dtext' crashes the workunit with:
Code: Select all
Error:    DATASET([{1,55,DATASET([{'aaa'},{'bbb'}], { string itm })}], rr).boundarytexts.itm - Table DATASET([{1,55,...}], rr).boundarytexts is not related to d (10, 10), 2131,


So is there a restriction on the types of items that can be looked up with DICTIONARY?

I notice that SET OF STRING works ok:
Code: Select all
RR := RECORD
    UNSIGNED2        AttributeID;
    UNSIGNED2        BoundaryType;
    SET OF STRING BoundaryTexts;
END;

d := DATASET([{1,55,['aaa','bbb']}],RR);

dtype := DICTIONARY(d,{AttributeID => BoundaryType});
dText := DICTIONARY(d,{AttributeID => BoundaryTexts});

//dtype[1].BoundaryType;
dText[1];
Allan
 
Posts: 431
Joined: Sat Oct 01, 2011 7:26 pm

Mon Apr 06, 2020 8:26 pm Change Time Zone

Allan,

I duplicated all this. It appears as though, while a DICTIONARY may be a nested child dataset, it may not contain a nested child dataset. IOW, this works:
Code: Select all
RR := RECORD
    UNSIGNED2        AttributeID;
    UNSIGNED2        BoundaryType;
    DATASET({STRING itm})  BoundaryTexts;
END;

d := DATASET([{1,55,DATASET([{'aaa'},{'bbb'}],{STRING itm})}],RR);

dtype := DICTIONARY(d,{AttributeID => BoundaryType});

dtype[1].BoundaryType;

If this is something you need, then a JIRA feature request would be in order.

HTH,

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

Tue Apr 07, 2020 6:44 am Change Time Zone

Thanks for the confirmation.

Perhaps a 'Documentation' ticket would be better. I don't 'need' it.
Created: https://track.hpccsystems.com/browse/HPCC-23834
Cheers

Allan
Allan
 
Posts: 431
Joined: Sat Oct 01, 2011 7:26 pm


Return to ECL

Who is online

Users browsing this forum: No registered users and 2 guests

cron