|
Re: Label expression with condition [message #1695842 is a reply to message #1695825] |
Tue, 19 May 2015 17:19 |
|
Hello,
It seems weird that this expression works in the interpreter as an
acceleo expression should be surrounded by [ /]. Anyway, Acceleo
provides the service "if" and should be used in a single expression as
follows:
[if(self.goalReference->isEmpty()) then '' else self.goalReference.name
endif/]
Note that if goalReference is a multivalued reference (as you use the
operation ->isEmpty) "self.goalReference.name" will return the
concatenation of the name of each referenced elements.
Regards,
Steve
Le 19/05/2015 16:30, Julien Delange a écrit :
> Hello,
>
> In a column, I would like to change the column label according to the
> eobject features: if there is a string, I want to show something,
> otherwise, show a generic label. So, I was looking for putting a "if"
> condition in the label expression. Unfortunately, my expression is not
> interpreted and my code is pasted in the column.
>
> The condition I put is the following:
> [ if (self.goalReference->isEmpty()) ]
> no reference
> [else]
> [self.goalReference.name]
> [/if]
>
> This condition/code works using the interpreter. But when I put it in
> the coilumn expression, it does not work
>
> Any idea how to do that?
>
> Thanks.
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: Label expression with condition [message #1695898 is a reply to message #1695844] |
Wed, 20 May 2015 07:56 |
|
Hello,
I do not think that this is caused by the version being a nightly build
(but I have been wrong before). The Acceleo language is pretty stable
and the nightly build should not be that different from an official
release. Why do you use a nightly build instead of a stable release?
Anyway, can you describe a little bit how is made your metamodel to work
this out? Is "goalReference" a multivalued reference? What is its parent
Metaclass? What is the type of this reference.
Regards,
Steve
Le 19/05/2015 19:39, Julien Delange a écrit :
> Hi Steve,
>
> I tried the solution but it does not work and it returns nothing - maybe
> this is because I am using the nightly build? is there any update on the
> acceleo language that would explain why the first solution worked first
> and your suggestion does not work, either in the interpreter or in the
> label expression?
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01830 seconds