PDA

View Full Version : how to auto generate the ID in Model?



sathyan_8294
3 Jan 2012, 11:00 PM
hai all,
1)
i have model fields are id,date,month,expense,amount...values are added successfully from sqlite to store,i want to auto increment the id in model for each row added in store from sqlite...how to do these...

2)
sum the amount daywise and monthwise separately working in list...is it possible to give sum of amount daywise and monthwise in single query...

tx.executeSql('SELECT Date,Month,sum(Amount) as Amount FROM categorydetails where date between "' + Ext.getCmp("expdetform").getValues().Date3.format("Y/m/d") + '" and "' + Ext.getCmp("expdetform").getValues().Date4.format("Y/m/d") + '" group by Date,Month order by Date', [], querySuccess, errorCB);---worked for daywise calculations

tx.executeSql('SELECT Month,sum(Amount) as Amount FROM categorydetails where date between "' + Ext.getCmp("expdetform").getValues().Date3.format("Y/m/d") + '" and "' + Ext.getCmp("expdetform").getValues().Date4.format("Y/m/d") + '" group by Month order by Date', [], querySuccess2, errorCB2);----worked for monthwise calculations

i want above 2 query in single line...is it possible...

3)
i have following output is coming
(Grouped by Month in List)
for example,(any month will come,here i given dec 2011 and jan 2012)
December,2011 ---Month
2011/12/12 145
2011/12/16 12

Total 157

January,2012
2012/01/02 15

Total 15

If i click date 12th dec means,its open detail of 12th Dec,then i click 16th dec means,its open details of 16th dec...then i click total means its open details of jan 2nd,then i click jan 2nd means,nothing is display...i want display details of 2nd jan when i click 2nd jan only...but it open for 1st total...how to solve this...

Sameer Khan
3 Jan 2012, 11:38 PM
indx = dataset.datasetlist.last().data.id + 1;

sathyan_8294
4 Jan 2012, 2:45 AM
hai shameer
u mentioned in C# code...i am asking in sencha touch javascript...