Bruce Perryman | 12 Jul 2006 03:41
Picon
Favicon

Help Evaluating Nested Maps

OK,

I'm doing something wrong, again.

This is the structure of my maps:

ABC
  ||
  =>DEF
        ||
        =>GHI
              ||
              =>A1=a
              =>A2=b
              =>A3=c
        =>GHI2
              ||
              =>B1=d
              =>B2=e
              =>B3=f

Hopefully this description makes sense to you. ABC contains a map DEF and DEF contains a few maps, two of which are GHI, and GHI2.

I am trying to evaluate A1 at the GHI level. This I do as follows:

${ABC.DEF.GHI.A1}

This results in the error that A1 is undefined. If I evaluate ${ABC.DEF.GHI} the error is that a string, etc. is expected but the expression evaluates to a simple hash.

Can you please point me in the right direction? Ultimately, I want to be able to use a variable to represent the GHI level with something like:

${ABC.DEF[x].A1}

But I thought I'd work with the 'simple' case first.

Thanks in advance for your help.

Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
fmpp-open mailing list
fmpp-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Daniel Dekany | 12 Jul 2006 05:07
Picon
Favicon

Re: Help Evaluating Nested Maps

I doesn't see any problem with this... so it's probably that GHI really doesn't have an entry with "A1" key, or that "A1" is mapped to a Java null value (that way the value is missing despite that the key exists).


What do you see if you list the hash entries like:


<#list ABC.DEF.GHI?keys as k>

${k} => ${ABC.DEF.GHI[k]?default('Java null')}

</#list>


Wednesday, July 12, 2006, 3:41:22 AM, Bruce Perryman wrote:


>

OK,


I'm doing something wrong, again.


This is the structure of my maps:


ABC

  ||

  =>DEF

        ||

        =>GHI

              ||

              =>A1=a

              =>A2=b

              =>A3=c

        =>GHI2

              ||

              =>B1=d

              =>B2=e

              =>B3=f


Hopefully this description makes sense to you. ABC contains a map DEF and DEF contains a few maps, two of which are GHI, and GHI2.


I am trying to evaluate A1 at the GHI level. This I do as follows:


${ABC.DEF.GHI.A1}


This results in the error that A1 is undefined. If I evaluate ${ABC.DEF.GHI} the error is that a string, etc. is expected but the expression evaluates to a simple hash.


Can you please point me in the right direction? Ultimately, I want to be able to use a variable to represent the GHI level with something like:


${ABC.DEF[x].A1}


But I thought I'd work with the 'simple' case first.


Thanks in advance for your help.



-- 

Best regards,

 Daniel Dekany


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
fmpp-open mailing list
fmpp-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Bruce Perryman | 12 Jul 2006 17:30
Picon
Favicon

Re: Help Evaluating Nested Maps

Great suggestion!

Implementing your suggestion revealed trailing whitespace in the keys. Removing the whitespace solved the problem.

Thanks a lot for your help and your great insight!

Daniel Dekany <ddekany <at> freemail.hu> wrote:

I doesn't see any problem with this... so it's probably that GHI really doesn't have an entry with "A1" key, or that "A1" is mapped to a Java null value (that way the value is missing despite that the key exists).

What do you see if you list the hash entries like:

<#list ABC.DEF.GHI?keys as k>
${k} => ${ABC.DEF.GHI[k]?default('Java null')}
</#list>

Wednesday, July 12, 2006, 3:41:22 AM, Bruce Perryman wrote:

>
OK,

I'm doing something wrong, again.

This is the structure of my maps:

ABC
  ||
  =>DEF
        ||
        =>GHI
              ||
              =>A1=a
              =>A2=b
              =>A3=c
        =>GHI2
              ||
              =>B1=d
              =>B2=e
              =>B3=f

Hopefully this description makes sense to you. ABC contains a map DEF and DEF contains a few maps, two of which are GHI, and GHI2.

I am trying to evaluate A1 at the GHI level. This I do as follows:

${ABC.DEF.GHI.A1}

This results in the error that A1 is undefined. If I evaluate ${ABC.DEF.GHI} the error is that a string, etc. is expected but the expression evaluates to a simple hash.

Can you please point me in the right direction? Ultimately, I want to be able to use a variable to represent the GHI level with something like:

${ABC.DEF[x].A1}

But I thought I'd work with the 'simple' case first.

Thanks in advance for your help.


-- 
Best regards,
 Daniel Dekany

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail Beta.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
fmpp-open mailing list
fmpp-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fmpp-open

Gmane