Hi,
I am trying to create a Base View for a JSON based Data Source :
[{"a":1, "b":2, "c":3},
{"a":11, "b":22, "c":33},
{"a":111, "b":222, "c":333},
{"a":1111, "b":2222, "c":3333},
{"a":11111, "b":22222, "c":33333}]
If I create the view using the default ‘JSON root’, the view returns an array as the first element, rather than the actual array elements that I require (but the data IS visible) :
```
DROP DATASOURCE JSON IF EXISTS abc CASCADE;
CREATE DATASOURCE JSON abc
ROUTE FTP 'ftp.FtpClientConnectionAdapter' 'ftp://abc' 'anonymous' '' ENCRYPTED;
DROP WRAPPER JSON IF EXISTS abc CASCADE;
CREATE WRAPPER JSON abc
DATASOURCENAME=abc
TUPLEROOT '/JSONFile'
OUTPUTSCHEMA (jsonfile = 'JSONFile' : REGISTER OF (
jsonarray = 'JSONArray' : ARRAY OF (
jsonarray = 'JSONArray' : REGISTER OF (
a = 'a' : 'java.lang.Integer',
b = 'b' : 'java.lang.Integer',
c = 'c' : 'java.lang.Integer'
)
)
)
);
DROP TYPE IF EXISTS abc_jsonarray_jsonarray CASCADE;
CREATE TYPE abc_jsonarray_jsonarray AS REGISTER OF (a:int, b:int, c:int);
DROP TYPE IF EXISTS abc_jsonarray CASCADE;
CREATE TYPE abc_jsonarray AS ARRAY OF abc_jsonarray_jsonarray;
DROP VIEW IF EXISTS abc CASCADE;
CREATE TABLE abc I18N us_est (
jsonarray:abc_jsonarray
)
CACHE OFF
TIMETOLIVEINCACHE DEFAULT
ADD SEARCHMETHOD abc(
I18N us_est
CONSTRAINTS (
ADD jsonarray NOS ZERO ()
ADD jsonarray NOS ZERO ()
ADD jsonarray.a NOS ZERO ()
ADD jsonarray.b NOS ZERO ()
ADD jsonarray.c NOS ZERO ()
)
OUTPUTLIST (jsonarray
)
WRAPPER (json abc)
);
```
https://ibb.co/BgwHs68
If I then specify ‘JSON root/jsonarray’, the schema view looks correct
But no data is returned :
```
DROP DATASOURCE JSON IF EXISTS abc CASCADE;
CREATE DATASOURCE JSON abc
ROUTE FTP 'ftp.FtpClientConnectionAdapter' 'ftp://abc/' 'anonymous' '' ENCRYPTED;
DROP WRAPPER JSON IF EXISTS abc_3208 CASCADE;
CREATE WRAPPER JSON abc_3208
DATASOURCENAME=abc
TUPLEROOT '/JSONFile/jsonarray'
OUTPUTSCHEMA (jsonfile = 'JSONFile' : REGISTER OF (
a = 'JSONFile.jsonarray.a' : 'java.lang.Integer',
b = 'JSONFile.jsonarray.b' : 'java.lang.Integer',
c = 'JSONFile.jsonarray.c' : 'java.lang.Integer'
)
);
DROP VIEW IF EXISTS abc CASCADE;
CREATE TABLE abc I18N us_est (
a:int,
b:int,
c:int
)
CACHE OFF
TIMETOLIVEINCACHE DEFAULT
ADD SEARCHMETHOD abc(
I18N us_est
CONSTRAINTS (
ADD a NOS ZERO ()
ADD b NOS ZERO ()
ADD c NOS ZERO ()
)
OUTPUTLIST (a, b, c
)
WRAPPER (json abc_3208)
);
```
https://ibb.co/bXgGm8F
Any advice on how to get this working much appreciated.