Wed Sep 30, 2020 10:35 am
Login Register Lost Password? Contact Us


Need to use active(dataset) to refer to the current row

Comments and questions related to the Enterprise Control Language

Fri Jan 17, 2020 2:41 pm Change Time Zone

Hi,

I wrote the following ECL function:
Code: Select all
//transform a NFA into a DFA
EXPORT NFAtoDFA (Model.NFA nfa) := FUNCTION
    DFAStatus := RECORD
        DATASET (Model.DFAState) tobeDone;
        DATASET (Model.DFATransition) transitions := DATASET([], Model.DFATransition);
    END;

    dfaStartState := DATASET([{Controller.Closure(nfa, nfa.states[1].value)}], Model.DFAState);

    currentDFAStatus := DATASET([{dfaStartState}], DFAStatus);

    finalDFAStatus := LOOP(currentDFAStatus,
                           COUNT(LEFT.tobeDone) > 0,
                           PROJECT(ROWS(LEFT),
                               TRANSFORM(DFAStatus,
                                     newTransitions := Controller.ComputeDFATransitions(nfa, LEFT.tobeDone[1]);                                     
                                     newStates := GetStatesFrom(newTransitions);
                                     newTobeDone := LEFT.tobeDone[2..] + newStates;
                                     SELF.transitions := LEFT.transitions + newTransitions;                                     
                                     SELF.tobeDone :=  DEDUP(newTobeDone, ALL))));   
   
    RETURN finalDFAStatus[1].transitions;
END;


However when running this, I get the following error:
ComputeDFATransitions(nfa, LEFT.tobeDone[1]) - Need to use active(dataset) to refer to the current row of an active dataset


Any idea on how to solve the issue?

Best regards,
Vannel
vzeufack
 
Posts: 41
Joined: Tue Sep 25, 2018 3:52 pm

Mon Jan 20, 2020 12:11 pm Change Time Zone

Not immediately, from a quick look the code looks correct.

What version of the platform are you using? (It might possibly be related to https://track.hpccsystems.com/browse/HPCC-20933).

I would probably need a copy of the archive of the query to be able to debug much further.
ghalliday
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 196
Joined: Wed May 18, 2011 9:48 am

Tue Jan 21, 2020 2:40 pm Change Time Zone

Hi @ghalliday,

I am using HPCCSystemsVM-amd64-7.2.20-1.
What do you mean by "archive of the query"?

Best regards,
Vannel,
vzeufack
 
Posts: 41
Joined: Tue Sep 25, 2018 3:52 pm

Tue Jan 21, 2020 3:01 pm Change Time Zone

When you submit the query it creates an xml archive - which contains all the code used by the query. If you look at the helpers tab in eclwatch you will see one of them is an archive. If you are happy for me to see the code you could email that to gavin <dot> halliday <at> lexisnexisrisk <dot> com and I can debug the issue.
ghalliday
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 196
Joined: Wed May 18, 2011 9:48 am

Tue Jan 21, 2020 7:02 pm Change Time Zone

OK Sent!
vzeufack
 
Posts: 41
Joined: Tue Sep 25, 2018 3:52 pm

Sat Jan 25, 2020 8:06 am Change Time Zone

I haven't seen an email yet. It is possible that it was blocked, but I don't think it would be.
ghalliday
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 196
Joined: Wed May 18, 2011 9:48 am

Mon Jan 27, 2020 3:07 pm Change Time Zone

Hi @Ghalliday,

I just sent again.

I think It may be because I did not use the email with which I registered in this forum.

Best regards,
Vannel,
vzeufack
 
Posts: 41
Joined: Tue Sep 25, 2018 3:52 pm

Mon Feb 03, 2020 10:26 am Change Time Zone

(Copied from email response:)

I think I have got to the bottom of the problem. The error may be correct, but the error location in the error message is very unhelpful.

The problem is in the following line in GetStatesFrom:

currentStatus := TABLE(transitions, statesFromStatusRec);

I think what you are trying to do is to create a data set with a single row that contains all the transitions as a child dataset. What that line is doing is creating a dataset with a row for each row in the transitions dataset. The complaint is coming because the record:

DATASET(Model.DFATransition) t := transitions;

which is called for each row in transitions, thinks it should be treated as

DATASET(Model.DFATransition) t := ROW(transitions);

I think what you want to achieve is probably:

currentStatus := DATASET([{transitions}], statesFromStatusRec);

If you actually want a dataset with one row for each transition, with the transitions dataset duplicated into each row then I would suggest using PROJECT instead of TABLE.

I have opened a jira to improve the error message. (HPCC-23437)
ghalliday
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 196
Joined: Wed May 18, 2011 9:48 am

Wed Feb 12, 2020 11:49 am Change Time Zone

Good Information.
kumarip
 
Posts: 1
Joined: Wed Feb 12, 2020 11:49 am


Return to ECL

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron