2

I'm using a nested map to store inputs from a Visualforce page and when I try to write the code to retrieve those inputs, I am getting "Error: Compile Error: Initial term of field expression must be a concrete SObject: MAP>> at line..."

Since I am not dealing with SObjects or fields in the nested map, I'm unclear on what the compiler wants me to do.

Here's some of the code and there error is reported on allvals, which is
Public Map>> allvals {get;set;} and is initialized in a separate method than the one causing the error:

        for (String s :allvals.keyset()){ //tables
          for (String r :allvals.get(s).keyset()){ //rows
            Integer tempTot=0;
            for (String c :allvals.get(s).get(r).keyset()){ //columns 
                if (c!=TOTAL) tempTot+=allvals.get[s].get[r].get[c];

Thanks in advance for your suggestions.

  • the error points right at the line and character for allvals. I would like to add the code where I set the values in the first place, but I'm not seeing how to add it to the question...still looking... – snugsfbay Dec 11 '14 at 14:37
3
 if (c!=TOTAL) tempTot+=allvals.get[s].get[r].get[c];

You are using square brackets here. Should you be using normal?

 if (c!=TOTAL) tempTot+=allvals.get(s).get(r).get(c);
  • Yes! Switching between Visualforce and Apex in one project, I often find myself using the wrong syntax in the wrong code. Thanks for catching that for me. – snugsfbay Dec 11 '14 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.