Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » check if a variable is defined
check if a variable is defined [message #24228] Thu, 28 June 2007 09:46 Go to next message
Tex Twil is currently offline Tex TwilFriend
Messages: 179
Registered: July 2009
Senior Member
Hello,
I'm programmatically defining some variables during a JET
transformation. Something like :

<c:setVariable var="var{$myID}" select="$ID" />

Which means that the name of my variable depends on the $ID variable.

Later during the execution I want to check weather a variable had been
defined and adapt the behavior consequently.
<c:choose>
<c:when test="$var{$myAnotherID}">
...
</c:when>
<c:otherwise>
...
</c:otherwise>
</c:choose>

But this doesn't work if the variable is not defined and that's exactly
what I want to detect. So is there a kind of #IFNDEF in JET ?

Thank you for your help,
Tex.
Re: check if a variable is defined [message #24270 is a reply to message #24228] Thu, 28 June 2007 10:22 Go to previous message
Tex Twil is currently offline Tex TwilFriend
Messages: 179
Registered: July 2009
Senior Member
I've just found this conversation :
http://www.eclipse.org/newsportal/article.php?id=233&gro up=eclipse.modeling.m2t#233

So I m trying to use the Java Scriplet but my problem is that the name
of my variable is dynamic and this doesn't work:

<% if(!context.hasVariable("var{$myAnotherID}")) { %>



Tex.

Tex Twil wrote:
> Hello,
> I'm programmatically defining some variables during a JET
> transformation. Something like :
>
> <c:setVariable var="var{$myID}" select="$ID" />
>
> Which means that the name of my variable depends on the $ID variable.
>
> Later during the execution I want to check weather a variable had been
> defined and adapt the behavior consequently.
> <c:choose>
> <c:when test="$var{$myAnotherID}">
> ...
> </c:when>
> <c:otherwise>
> ...
> </c:otherwise>
> </c:choose>
>
> But this doesn't work if the variable is not defined and that's exactly
> what I want to detect. So is there a kind of #IFNDEF in JET ?
>
> Thank you for your help,
> Tex.
Previous Topic:JET2-GMF/EMF Access Container class
Next Topic:simple IF .. ELSE statement
Goto Forum:
  


Current Time: Sat Apr 27 03:20:24 GMT 2024

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

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

Back to the top