How to get attribite's value of entity which be pointed by local entity

31 views
Skip to first unread message

Binh Le Nguyen Sy

unread,
Dec 20, 2012, 4:51:14 AM12/20/12
to dtr...@googlegroups.com
Hi Paul , 

I have three entities , they are  :
    person (name:string)
    student (info : person)
    job(output : string)

In the contexts of decision table :
   local entity var = student.info

In the Actions of decision table, I tried this:
  1.   set job.output = var's name
  2.   set job.output = var.name

But this gives compile errors.
Please help me get value of the name. 

Thanks

paul snow

unread,
Dec 20, 2012, 10:16:05 AM12/20/12
to dtr...@googlegroups.com
Here is what I think you are saying.  You have a Person entity with an attribute name of type string.  You have a student with an entity attribute info with a subtype of person.  And you have a job entity with an attribute output.

In a decision table you create a var that points to the entity specified by student.info.  If that is true (and you are not getting any other errors on the declaration of var)  then the syntax:

set job.output = var's name

should work.  

If you are getting an error, could you cut and paste the actual error here?  

Thanks,

Paul
Message has been deleted

Binh Le Nguyen Sy

unread,
Dec 21, 2012, 5:04:04 AM12/21/12
to dtr...@googlegroups.com
This is the follow message when i compile :
      Starting: Fri Dec 21 15:35:42 ICT 2012
      Converting: Fri Dec 21 15:35:42 ICT 2012
      ChipEligibility_dt 01.xls
         Compute_Eligibility
      Compiling: Fri Dec 21 15:35:42 ICT 2012

      Error:
      Decision Table: Compute_Eligibility
      Filename:       ChipEligibility_dt 01.xls

      Source:         set job.output = var's name
      Error:          
      File name:      null
      Location:       'Parsing a action'
      Type:           'compileError'
      Error:          'set job.output = var's  *ERROR*=> name'
      Info:           The parser didn't expect the token 'name'

      The following are the tokens that the parser recognized:
      ACTION : action
      SET : set
      RSTRING : job.output
      ASSIGN : =
      POSSESSIVE : 0 local@ 
      COMMA : ,
      NAME : name

      Total Errors Found: 1
      Done: Fri Dec 21 15:35:42 ICT 2012

And this is the my decision table

Thanks,

Binh

paul snow

unread,
Dec 21, 2012, 11:06:32 AM12/21/12
to dtr...@googlegroups.com
The compiler models natural language as much as possible.  The problem is that 'name' is a key word used by the language, because name objects are a fundamental part of the language. (I should have picked up on that earlier, and the compiler should give you an error that is easier to understand at compile time).

The hint about this is in the error message:

      The following are the tokens that the parser recognized:
      ACTION : action
      SET : set
      RSTRING : job.output
      ASSIGN : =
      POSSESSIVE : 0 local@ 
      COMMA : ,
      NAME : name

The token isn't of a type that is acceptable to the syntax, and in fact is parsed out as NAME.  I went to another rule set I have and added an error to pull the token list out of a correct syntax for setting a string.  This shows the tokens the Rules Engine expects:

Error:
Decision Table: Create_Relationships_Fill
Filename:       MAGI_test_dt.xls

Source:         set relationship's type = ""; xxx
Location:       'Parsing: action'
Type:           'compileError'
Error:          'set relationship's type = "";  *ERROR*=> xxx'
Info:           'xxx' is undefined

The following are the tokens that the parser recognized:
ACTION : action
SET : set
POSSESSIVE : relationship
COMMA : ,
RSTRING : type
ASSIGN : =
STRING : ""
SEMI : ;
UNDEFINED : xxx

Notice the syntax (less the error I added, i.e the "; xxx") is just like what you are using.  But if you look at the token list, type is parsed as an RSTRING.  Your name was parsed as a NAME.  So if you rename that attribute to something like Full_Name or person_name, etc. then you will be good.  Remember that EL and EBL (languages used by DTRules) are case insensitive, so just changing the case of the attribute isn't going to fix this problem.

Binh Le Nguyen Sy

unread,
Dec 22, 2012, 10:06:07 AM12/22/12
to dtr...@googlegroups.com
Thank you for quick response.
Merry Christmas :)

Best regard,

Binh
Reply all
Reply to author
Forward
0 new messages