evalProviderJsonPath
evalProviderJsonPath
Reads a value from a Provider Instance's current response data using a JSONPath expression.
Parameters
recvPath(dynamic): The name of the Provider Instance to queryregularPath(String): The JSONPath expression (e.g."$.list[0].name")
Returns: List — the value matching the JSONPath, or null if the path does not exist
Description
Use it when you need to extract only the value at a specific path, more precisely than getProviderData allows. Internally it uses the PI's blockPath evaluation engine.
Example
// PI 응답에서 첫 번째 항목의 이름 추출
var name = $vm.evalProviderJsonPath("stockProvider", "$.list[0].name");
$log.i("첫 항목:", name);
// 전체 리스트 추출
var list = $vm.evalProviderJsonPath("stockProvider", "$.list");
$log.i("항목 수:", list ? list.length : 0);
Related
$vm.getProviderData(path)— read a PI's full data$vm.getPiResultValue(piName, blockPath)— read a value from the last response (onResponseUpdate only)