Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Undefined "Let" expression(Acceleo Evaluation Exception: Undefined "Let" expression at line .. in Module ... for block ...)
[Acceleo] Undefined "Let" expression [message #1702386] Wed, 22 July 2015 00:26 Go to next message
Samuel Windall is currently offline Samuel WindallFriend
Messages: 6
Registered: July 2015
Junior Member
I am getting the error:
Acceleo Evaluation Exception: Undefined "Let" expression at line .. in Module ... for block ...

Here is my template:
[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/emf/2002/Ecore', 'http://www.eclipse.org/emf/compare', 'http:// ww.workingmouse.com/mdsaas/featuremodel')]

[template public generateElement(comparison : Comparison)]
[comment @main/]
[file ('update.sql', false, 'UTF-8')]
/*SQL UPDATE SCRIPT TEST*/
[for (difference : Diff | comparison.getDifferences())]
	[let rc : ReferenceChange = difference.oclAsType(ReferenceChange)]
		[let dc : DomainClass = rc.value.oclAsType(DomainClass)]
[printTodo(difference.kind.toString(), 'DomainClass', dc.name.toString())/]
		[elselet da : DomainAttribute = rc.value.oclAsType(DomainAttribute)]
[printTodo(difference.kind.toString(), 'DomainAttribute', da.name.toString())/]
		[elselet t : Tile = rc.value.oclAsType(Tile)]
[printTodo(difference.kind.toString(), 'Tile', t.name.toString())/]
		[elselet dcr : DomainClassReference = rc.oclAsType(DomainClassReference)]
[printTodo(difference.kind.toString(), 'DomainClassReference', dcr.name.toString())/]
		[else]
ELSE
	 	[/let]
	[/let]
[/for]
[/file]
[/template]

[template public printTodo(kind : String, type : String, name : String)]
//TODO: [kind.toLowerCase().toUpperFirst()/] the [type/] '[name/]'
[/template] 

This is the output:
/*SQL UPDATE SCRIPT TEST*/
//TODO: Add the DomainClass 'null'


With this stacktrace in the console:
Quote:

!ENTRY org.eclipse.acceleo.engine 2 2 2015-07-22 10:17:00.066
!MESSAGE Undefined "Let" expression at line 10 in Module generate for block let dc : DomainClass = rc.value.oclAsType(featuremodel::DomainClass). Last recorded value of self was ReferenceChangeSpec{reference=AbstractWithAttributes.attributes, value=Integer@4f72078d Test, parentMatch=MatchSpec{left=DomainClass@2262bc86 Text, right=DomainClass@4c4be9d8 Text, origin=<null>, #differences=3, #submatches=3}, match of value=MatchSpec{left=Integer@4f72078d Test, right=<null>, origin=<null>, #differences=0, #submatches=0}, kind=ADD, source=LEFT, state=UNRESOLVED}. Problem found while generating the file 'C:\Users\Samuel\Desktop\Workspace\VersionSandbox\models\update.sql'.
!STACK 0
org.eclipse.acceleo.engine.AcceleoEvaluationException: Undefined "Let" expression at line 10 in Module generate for block let dc : DomainClass = rc.value.oclAsType(featuremodel::DomainClass). Last recorded value of self was ReferenceChangeSpec{reference=AbstractWithAttributes.attributes, value=Integer@4f72078d Test, parentMatch=MatchSpec{left=DomainClass@2262bc86 Text, right=DomainClass@4c4be9d8 Text, origin=<null>, #differences=3, #submatches=3}, match of value=MatchSpec{left=Integer@4f72078d Test, right=<null>, origin=<null>, #differences=0, #submatches=0}, kind=ADD, source=LEFT, state=UNRESOLVED}. Problem found while generating the file 'C:\Users\Samuel\Desktop\Workspace\VersionSandbox\models\update.sql'.
at generate.generateElement(Comparison)(generate.mtl:10)
at generate.generateElement(Comparison)(generate.mtl:9)
at generate.generateElement(Comparison)(generate.mtl:8)
at generate.generateElement(Comparison)(generate.mtl:6)
at generate.generateElement(Comparison)(generate.mtl:4)

!ENTRY org.eclipse.acceleo.engine 2 2 2015-07-22 10:17:00.073
!MESSAGE Undefined "Let" expression at line 10 in Module generate for block let dc : DomainClass = rc.value.oclAsType(featuremodel::DomainClass). Last recorded value of self was ReferenceChangeSpec{reference=AbstractWithAttributes.attributes, value=Stringg@21dd91da Title, parentMatch=MatchSpec{left=DomainClass@2262bc86 Text, right=DomainClass@4c4be9d8 Text, origin=<null>, #differences=3, #submatches=3}, match of value=MatchSpec{left=<null>, right=Stringg@21dd91da Title, origin=<null>, #differences=0, #submatches=0}, kind=DELETE, source=LEFT, state=UNRESOLVED}. Problem found while generating the file 'C:\Users\Samuel\Desktop\Workspace\VersionSandbox\models\update.sql'.
!STACK 0
org.eclipse.acceleo.engine.AcceleoEvaluationException: Undefined "Let" expression at line 10 in Module generate for block let dc : DomainClass = rc.value.oclAsType(featuremodel::DomainClass). Last recorded value of self was ReferenceChangeSpec{reference=AbstractWithAttributes.attributes, value=Stringg@21dd91da Title, parentMatch=MatchSpec{left=DomainClass@2262bc86 Text, right=DomainClass@4c4be9d8 Text, origin=<null>, #differences=3, #submatches=3}, match of value=MatchSpec{left=<null>, right=Stringg@21dd91da Title, origin=<null>, #differences=0, #submatches=0}, kind=DELETE, source=LEFT, state=UNRESOLVED}. Problem found while generating the file 'C:\Users\Samuel\Desktop\Workspace\VersionSandbox\models\update.sql'.
at generate.generateElement(Comparison)(generate.mtl:10)
at generate.generateElement(Comparison)(generate.mtl:9)
at generate.generateElement(Comparison)(generate.mtl:8)
at generate.generateElement(Comparison)(generate.mtl:6)
at generate.generateElement(Comparison)(generate.mtl:4)

!ENTRY org.eclipse.acceleo.engine 2 2 2015-07-22 10:17:00.077
!MESSAGE Undefined "Let" expression at line 10 in Module generate for block let dc : DomainClass = rc.value.oclAsType(featuremodel::DomainClass). Last recorded value of self was ReferenceChangeSpec{reference=DomainClass.display, value=Stringg@21dd91da Title, parentMatch=MatchSpec{left=DomainClass@2262bc86 Text, right=DomainClass@4c4be9d8 Text, origin=<null>, #differences=3, #submatches=3}, match of value=MatchSpec{left=<null>, right=Stringg@21dd91da Title, origin=<null>, #differences=0, #submatches=0}, kind=CHANGE, source=LEFT, state=UNRESOLVED}. Problem found while generating the file 'C:\Users\Samuel\Desktop\Workspace\VersionSandbox\models\update.sql'.
!STACK 0
org.eclipse.acceleo.engine.AcceleoEvaluationException: Undefined "Let" expression at line 10 in Module generate for block let dc : DomainClass = rc.value.oclAsType(featuremodel::DomainClass). Last recorded value of self was ReferenceChangeSpec{reference=DomainClass.display, value=Stringg@21dd91da Title, parentMatch=MatchSpec{left=DomainClass@2262bc86 Text, right=DomainClass@4c4be9d8 Text, origin=<null>, #differences=3, #submatches=3}, match of value=MatchSpec{left=<null>, right=Stringg@21dd91da Title, origin=<null>, #differences=0, #submatches=0}, kind=CHANGE, source=LEFT, state=UNRESOLVED}. Problem found while generating the file 'C:\Users\Samuel\Desktop\Workspace\VersionSandbox\models\update.sql'.
at generate.generateElement(Comparison)(generate.mtl:10)
at generate.generateElement(Comparison)(generate.mtl:9)
at generate.generateElement(Comparison)(generate.mtl:8)
at generate.generateElement(Comparison)(generate.mtl:6)
at generate.generateElement(Comparison)(generate.mtl:4)

I also printed the rc.value with
[rc.value.toString()/]
on line 10 for debug purposes, the output was:
/*SQL UPDATE SCRIPT TEST*/
featuremodel.impl.IntegerImpl@7b1d2f65 (versionID: -1) (docoDescription: :), name: Test, listOrderable: false, indexed: NONE, label: true, allowCreate: true, allowUpdate: YES, isDashboard: false, defaultValue: null, tooltip: null, importType: OVERWRITE, required: false) (display: SPINNER) (DBType: INT)
featuremodel.impl.StringgImpl@4536a09a (versionID: 5) (docoDescription: The heading or title for the content text, name: Title, listOrderable: false, indexed: NONE, label: true, allowCreate: true, allowUpdate: YES, isDashboard: false, defaultValue: null, tooltip: The heading or title for the content text, importType: OVERWRITE, required: true) (DBType: VARCHAR, display: TEXTFIELD, i18n: true)
featuremodel.impl.StringgImpl@4536a09a (versionID: 5) (docoDescription: The heading or title for the content text, name: Title, listOrderable: false, indexed: NONE, label: true, allowCreate: true, allowUpdate: YES, isDashboard: false, defaultValue: null, tooltip: The heading or title for the content text, importType: OVERWRITE, required: true) (DBType: VARCHAR, display: TEXTFIELD, i18n: true)
featuremodel.impl.DomainClassImpl@7c857e8f (versionID: -1) (docoDescription: Demo, docoVideoURL: null, name: null) (isDashboard: false) (isMember: false, isOrderable: false, contributeToQuestionTile: NO, allowPermissions: false, hasContent: NO, hasCost: false, hasQuestions: NONE, hasReminder: false, hasTimeline: false, hasWorkflow: false, sharableOn: null, allowCreate: true, allowUpdate: YES, allowDelete: true, allowInactive: false, allowImport: NONE, allowDuplicate: false, allowExport: NONE, contributeToMenu: true)
//TODO: Add the DomainClass 'null'


I have no clue what to do?
Any help would be much appreciated

[Updated on: Wed, 22 July 2015 00:27]

Report message to a moderator

Re: [Acceleo] Undefined "Let" expression [message #1702387 is a reply to message #1702386] Wed, 22 July 2015 01:47 Go to previous message
Samuel Windall is currently offline Samuel WindallFriend
Messages: 6
Registered: July 2015
Junior Member
Apparently the Acceleo Let function attempts to cast and moves to the next block if the current on fails. So I removed all the .oclAsType() calls and it worked fine. Although i have a few "Possible incompatible type between 'ReferenceChange' and 'Diff'." warnings
Previous Topic:[Acceleo] Random Plugin Errors
Next Topic:[XPAND2] Learning basic
Goto Forum:
  


Current Time: Thu Nov 30 10:40:32 GMT 2023

Powered by FUDForum. Page generated in 0.02086 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top