Custom table Column value Site wise auto increment by 1

srini vasulu, modified 5 Years ago. Regular Member Posts: 139 Join Date: 2/22/11 Recent Posts
Hi All,
I have a requirement custom table Column value Site wise auto increment by 1.
for example table name Example and Column A . now i have site A,B when adding the Record in site A for every row Column A to increse by 1 like 1,2,3,4... Ect. same scenario for site B it want to stat again from 1,2,3,4 ...ect.
Thanks in Advance

Thanks,
Srini
thumbnail
Mohammed Yasin, modified 5 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Hi ,You can use Liferay CounterLocalserviceUtil and do increment by 1 . 
CounterLocalserviceUtil.increament("SITEA", 1)/CounterLocalserviceUtil.increament("SITEB, 1);
You need to set in portal.properties also
counter.increment.SITEA=1
counter.increment.SITEB=1
srini vasulu, modified 5 Years ago. Regular Member Posts: 139 Join Date: 2/22/11 Recent Posts
Thank you it's worked perfectly what i am expected.
Mohammed Yasin:

Hi ,You can use Liferay CounterLocalserviceUtil and do increment by 1 . 
CounterLocalserviceUtil.increament("SITEA", 1)/CounterLocalserviceUtil.increament("SITEB, 1);
You need to set in portal.properties also
counter.increment.SITEA=1
counter.increment.SITEB=1