salesforce - How to increment a value in a map with Apex? -


is there way increment value in map without needing second variable?

for example, doesn't work:

counts = new map<string,integer>(); counts.put('month_total',0); counts.put('month_total',counts.get['month_total']++); 

it returns "initial term of field expression must concrete sobject: map"

instead needed do:

counts = new map<string,integer>(); counts.put('month_total',0); integer temp = 0; temp++; counts.put('month_total',temp); 

is there way increment without needing variable?

replace

counts.put('month_total',counts.get['month_total']++); 

with

counts.put('month_total',counts.get('month_total')++); 

Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -