@headshot8x wrote:
Hello guys, I want to create a function auto ID. Example : In table Product have ID ( P0001,P0004,P0006) . It'll create ID with value P0002. Logic as follow
1) Check row in table Product , if not row , the value first is P0001
2) If some rows in table , check some case and create ID
+ P0002,P0004,P0005 CREATE P0001
+ P0001,P0002,P0004,P0005 CREATE P0003
+ P0003,P0004,P0001,P0005.P0007 CREATE P0002
etc...$scope.ListProID = [];
$scope.GetProID = function () {
CatList.select('Select ProID from product', []).then(function (res) {
$scope.ListProID = res;
console.log(res);
if (res.length == 0) { ///not row in table product
return 'P0001';
}
else { //create ProID
for (var i = 0; i < res.rows.length; i++) {
// check value of ID and create ID
//
}
// return value of ID new;
}
});
};Thank you.
Posts: 1
Participants: 1