Я создал новую запись с ветром, на отправке Я хочу немедленно получить идентификатор записи, используя основные поля, которые я использовал для создания записи, например, используя электронную почту, пожалуйста, как я могу получите идентификатор новой записи, используя ветерок.Как запросить идентификатор записи с помощью BreezeJS
это то, что я сделал
bind gotoStep2() with the save button which pass in the value of the textbox to use as predicate,
// the save() method successfully create the record to the database,
function gotoStep2(firstName, lastName, email) {
save();
console.log('Save log')
// Get the ProfileID
return datacontext.profile.getProfileId(firstName, lastName, email)
.then(function (data) {
console.log('Id retrived is: ' + data.Id); // check the value returned
vm.profile = data;
//$location.path('/step-two/' + data.Id);
// Todo: pass the value to the next route
}, function (error) {
logError('Unable to get speaker');
});
}
function getProfileId(firstName, lastName, email) {
var self = this;
var predicate = Predicate.create('firstName', '==', firstName)
.and('lastName', '==', lastName)
.and('email', '==', email);
var profiles = [];
return EntityQuery.from('Profiles')
.select('id')
.where(predicate)
.toType(entityName)
.using(self.manager).execute()
.then(querySucceeded, self._queryFailed);
function querySucceeded(data) {
profiles = data.results;
self.log('Retrieved [Profile by email] from remote data source', profiles.length, true);
return profiles;
}
}
из приведенного выше запроса всегда не получить любое возвращаемое значение
Благодаря
Мне нужен пример запроса о том, как получить идентификатор записи путем запроса с помощью предиката. – user3590299