1e41f4b71Sopenharmony_ci# DataAbilityResult
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **DataAbilityResult** module defines the operation result on DataAbilities. When you call [executeBatch](js-apis-inner-ability-dataAbilityHelper.md#dataabilityhelperexecutebatch) to operate the database, the operation result is returned through the **DataAbilityResult** object.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci> 
7e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci> The APIs of this module can be used only in the FA model.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Modules to Import
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci```ts
13e41f4b71Sopenharmony_ciimport ability from '@ohos.ability.ability';
14e41f4b71Sopenharmony_ci```
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci## Attributes
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci| Name     | Type | Read Only | Optional   |       Description  |
21e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
22e41f4b71Sopenharmony_ci| uri      | string    | No | Yes   | URI of the DataAbility. Example: 'dataability:///com.example.xxx.xxxx'. |
23e41f4b71Sopenharmony_ci| count     | number   | No | Yes   | Number of rows affected by the operation. |
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**Example**
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci<!--code_no_check_fa-->
28e41f4b71Sopenharmony_ci```ts
29e41f4b71Sopenharmony_ciimport ability from '@ohos.ability.ability';
30e41f4b71Sopenharmony_ciimport featureAbility from '@ohos.ability.featureAbility';
31e41f4b71Sopenharmony_ciimport rdb from '@ohos.data.rdb';
32e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci// Perform database operations in batches.
35e41f4b71Sopenharmony_cifunction executeBatchOperation() {
36e41f4b71Sopenharmony_ci    let dataAbilityUri = ('dataability:///com.example.myapplication.TestDataAbility');
37e41f4b71Sopenharmony_ci    let DAHelper: ability.DataAbilityHelper;
38e41f4b71Sopenharmony_ci    DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri);
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci    let valueBucket: rdb.ValuesBucket = {
41e41f4b71Sopenharmony_ci        'name': 'DataAbilityHelperTest',
42e41f4b71Sopenharmony_ci        'age': 24,
43e41f4b71Sopenharmony_ci        'salary': 2024.20,
44e41f4b71Sopenharmony_ci    };
45e41f4b71Sopenharmony_ci    let predicateBackReferences = new Map<number, number>()
46e41f4b71Sopenharmony_ci    predicateBackReferences.set(1, 1)
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci    let operations: Array<ability.DataAbilityOperation> = [
49e41f4b71Sopenharmony_ci        {
50e41f4b71Sopenharmony_ci            uri: dataAbilityUri,
51e41f4b71Sopenharmony_ci            type: featureAbility.DataAbilityOperationType.TYPE_INSERT,
52e41f4b71Sopenharmony_ci            valuesBucket: valueBucket,
53e41f4b71Sopenharmony_ci            expectedCount: 1,
54e41f4b71Sopenharmony_ci            predicatesBackReferences: predicateBackReferences,
55e41f4b71Sopenharmony_ci            interrupted: true,
56e41f4b71Sopenharmony_ci        },
57e41f4b71Sopenharmony_ci        {
58e41f4b71Sopenharmony_ci            uri: dataAbilityUri,
59e41f4b71Sopenharmony_ci            type: featureAbility.DataAbilityOperationType.TYPE_INSERT,
60e41f4b71Sopenharmony_ci            valuesBucket: valueBucket,
61e41f4b71Sopenharmony_ci            expectedCount: 1,
62e41f4b71Sopenharmony_ci            predicatesBackReferences: predicateBackReferences,
63e41f4b71Sopenharmony_ci            interrupted: true,
64e41f4b71Sopenharmony_ci        }
65e41f4b71Sopenharmony_ci    ];
66e41f4b71Sopenharmony_ci    try {
67e41f4b71Sopenharmony_ci        DAHelper.executeBatch(dataAbilityUri, operations).then((data) => {
68e41f4b71Sopenharmony_ci            for (let i = 0; i < data.length; i++) {
69e41f4b71Sopenharmony_ci                let dataAbilityResult: ability.DataAbilityResult = data[i];
70e41f4b71Sopenharmony_ci                console.log(`dataAbilityResult.uri: ${dataAbilityResult.uri}`);
71e41f4b71Sopenharmony_ci                console.log(`dataAbilityResult.count: ${dataAbilityResult.count}`);
72e41f4b71Sopenharmony_ci            }
73e41f4b71Sopenharmony_ci        }).catch((err: BusinessError) => {
74e41f4b71Sopenharmony_ci            console.error(`executeBatch error: ${JSON.stringify(err)}`);
75e41f4b71Sopenharmony_ci        });
76e41f4b71Sopenharmony_ci    } catch (err) {
77e41f4b71Sopenharmony_ci        console.error(`executeBatch error: ${JSON.stringify(err as BusinessError)}`);
78e41f4b71Sopenharmony_ci    }
79e41f4b71Sopenharmony_ci}
80e41f4b71Sopenharmony_ci```
81