Example i have set of values in JSON file like zip code, City and State code. If user enter the value of zip code, i need to search the value in the json file and get the appropriate city and state value.
So need to know how to import the external json file to avoka and need to read the data in the json file.
If you have a large set of JSON data you need to reference in your applications please use the PropertyQuery class to lookup these values.
To load reference data into Transact from an external system please use the service template below:
Next specify the Organization property name you want for your reference data, and the REST service file parameter name for the upload operation.
You can then upload reference data using this service via the REST Groovy Service Invoke API. Please see the documentation below:
Groovy Service Invoke
regards Malcolm Edgar
In your Fluent Groovy Service you can add a service parameter to store the JSON data. If you are using an IDE just drop the JSON file into your service directory and add the service parameter to the service-def.json file with the filePath attribute pointing to your JSON file e.g.:
See the following article for more detail on the service-def.json file:
Then in your Fluent Groovy script you can access this service parameter and interrogate it using the Path class.
Assuming your JSON data looks something like:
you could interrogate the data as follows:
For more information on interrogating structured data paths see the following article:
You can verify this code by including a unit test script as follows:
Running this test script in Transaction Manager you should see output similar to the following: