On Tue, Jul 26, 2016 at 5:36 PM, D R <rir....@gmail.com> wrote:

> Hi,
>
> many thanks. So now I have
>
> #set($obj = $doc.getObject('Customer Profile.Code.Customer ProfileClass'))
>     #set($rawValue = $obj.getProperty('sListSupportLevel').value)
>     #foreach( $level in $rawValue )
>       $level <br />
>     #end
>
> and it displays the raw values. I feel dumb asking this but I was not able
> to get it working: How to get the pretty names of the raw values in the
> foreach loop?
>

On the same link I gave you there is an example for how to "access the
class object representing SomeSpace.SomeClass" and to access a property
from the class. Then you can use
http://platform.xwiki.org/xwiki/bin/view/ScriptingDocumentation/?url=http:%2F%2Fnexus.xwiki.org%2Fnexus%2Fservice%2Flocal%2Frepositories%2Fpublic%2Farchive%2Forg%2Fxwiki%2Fplatform%2Fxwiki-platform-oldcore%2F7.4.2%2Fxwiki-platform-oldcore-7.4.2-javadoc.jar%2F!%2Fcom%2Fxpn%2Fxwiki%2Fapi%2FPropertyClass.html%23getMapValues()
to get the mapping between the raw values and the display pretty value.

Hope this helps,
Marius


>
> Thanks again,
> Dennis
>
> 2016-07-13 11:04 GMT+02:00 Marius Dumitru Florea <
> mariusdumitru.flo...@xwiki.com>:
>
> > Have you checked the link I gave you? It has an example that shows how
> > to "Retrieve
> > the raw value of the property".
> >
> > On Tue, Jun 28, 2016 at 4:43 PM, D R <rir....@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > Yes, I want to display the values of the field ddlProductFamily. It is
> a
> > > multi-select list field. In the application I added a new item where I
> > > selected "Value1" and "Value3" of the list field. It displays fine
> using
> > > $doc.display('ddlProductFamily') but I want to print the selected
> values
> > > below each other so I used the #foreach loop but it's always empty. I
> > have
> > > another #foreach loop where I display attachments which works fine so I
> > > wonder what's special about the list field items.
> > >
> > > Regards,
> > > Dennis
> > >
> > > 2016-06-24 8:59 GMT+02:00 Marius Dumitru Florea <
> > > mariusdumitru.flo...@xwiki.com>:
> > >
> > > > On Thu, Jun 23, 2016 at 5:32 PM, D R <rir....@gmail.com> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I am currently implementing my first XWiki application and starting
> > to
> > > > > learn velocity. There is one thing that makes me mad.
> > > > >
> > > > > There is a static list field with code "ddlProductFamily".
> > > > >
> > > > >
> > > >
> > > > > I try to display the items in this list in a nice way (one below
> the
> > > > > other).
> > > > >
> > > >
> > > > It's not very clear what you want to display:
> > > > (1) the value of the ddlProductFamily field? i.e. the selected
> values?
> > > Does
> > > > this field have multiple selection enabled?
> > > > (2) the list of values the ddlProductFamily field can chose from?
> i.e.
> > > the
> > > > allowed values, what is specified in the static list definition
> > > >
> > > > In any case you should check
> > > >
> > > >
> > >
> >
> http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HAccessobjectsinapage
> > > > . And before you try to iterate something you should first
> > display/print
> > > it
> > > > to see if it's really something that can be iterated (a list or an
> > > array).
> > > >
> > > > Hope this helps,
> > > > Marius
> > > >
> > > >
> > > > >
> > > > > Different approaches including googling didn't lead to any outcome.
> > > > >
> > > > > #foreach ($prodFam in $ddlProductFamily)
> > > > >   $prodFam\\
> > > > > #end
> > > > >
> > > > > #foreach ($prodFam in $doc.display('ddlProductFamily'))
> > > > >   $prodFam\\
> > > > > #end
> > > > >
> > > > > On the frontend it's always empty. Other #foreach loops work fine.
> > > > >
> > > > > I'm sure I just misunderstand something but I can't find the fault
> > > > myself.
> > > > > Can somebody please help me?
> > > > >
> > > > > Thanks in advance,
> > > > > Dennis
> > > > > _______________________________________________
> > > > > users mailing list
> > > > > users@xwiki.org
> > > > > http://lists.xwiki.org/mailman/listinfo/users
> > > > >
> > > > _______________________________________________
> > > > users mailing list
> > > > users@xwiki.org
> > > > http://lists.xwiki.org/mailman/listinfo/users
> > > >
> > > _______________________________________________
> > > users mailing list
> > > users@xwiki.org
> > > http://lists.xwiki.org/mailman/listinfo/users
> > >
> > _______________________________________________
> > users mailing list
> > users@xwiki.org
> > http://lists.xwiki.org/mailman/listinfo/users
> >
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to