Function: addSoilAnalysis()
addSoilAnalysis(
fdm
,principal_id
,a_date
,a_source
,b_id
,b_depth
,b_sampling_date
,soilAnalysisData?
):Promise
<any
>
Defined in: fdm-core/src/soil.ts:34
Adds a new soil analysis record along with its soil sampling details.
This function verifies that the principal has write access to the specified field, then creates new entries in the soil analysis and soil sampling tables within a database transaction. The ID of the newly created soil analysis record is returned.
Parameters
fdm
any
The FDM instance providing the connection to the database. The instance can be created with createFdmServer.
principal_id
any
The identifier of the principal performing the operation.
a_date
any
The date when the soil analysis was performed.
a_source
any
The source of the soil analysis data.
b_id
any
The identifier of the field where the soil sample was collected.
b_depth
any
The depth at which the soil sample was taken.
b_sampling_date
any
The date when the soil sample was collected.
soilAnalysisData?
any
Optional additional data for the soil analysis (e.g., pH, nutrient levels).
Returns
Promise
<any
>
The ID of the newly added soil analysis record.
Throws
If the database transaction fails.