将值从modified()传递给ax中的lookup()

时间:2016-08-29 06:58:22

标签: axapta x++

如何在 AX 中将值从modified()传递到lookup()? 我需要输出,因为当我单击textBox中的值时,会根据文本框中的值自动对查找中的值进行排序。

1 个答案:

答案 0 :(得分:2)

您可以声明文本框属性 func deleteUserInfo() { let context = appdelegate.managedObjectContext let coord = appdelegate.persistentStoreCoordinator let fetchRequest = NSFetchRequest(entityName: "entityname") //Here is the field on which u need to chk which record u want to delete just pass here in value ( acutal value) unique key = field in coredata let predicate = NSPredicate(format: "uniqueKey == %@", "value") fetchRequest.predicate = predicate if #available(iOS 9.0, *) { //You can put condition to delete data accordingly let deleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest) do { try coord.executeRequest(deleteRequest, withContext: context) } catch let error as NSError { //Error handling } catch {} } else { // Fallback on earlier versions do { let users: NSArray = try appdelegate.managedObjectContext.executeFetchRequest(fetchRequest) //You can put condition to delete data accordingly for user in users { appdelegate.managedObjectContext.delete(user) } try appdelegate.managedObjectContext.save() } catch let error as NSError { //Error handling } catch {} } }

然后在查找方法中写下这个Autodeclaration = Yes

结果是文本框的值。