Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
The GetTableAndKeys method doesn't return the fields in column order.
I want to use the data to output table headings (I can then use GetTableData to get the table data.)
Is this a bug? What's an alternative method to retrieve source table columns in the correct order?
thanks,
Shane.
So, the GetTableAndKeys method call doesn't return columns in the correct order, but...
if I pass in a -1 for the offset in the GetTableData method call, I get the column names as the first row. At least now I get a match between data and column names (even if the column names aren't strictly in the same order).
Some more info:
The script that loads the data:
Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;
The result:
Num | Alpha |
A | 1 |
B | 2 |
C | 3 |
D | 4 |
E | 5 |
F | 6 |
G | 7 |
H | 8 |
I | 9 |
J | 10 |
K | 11 |
L | 12 |
M | 13 |
N | 14 |
O | 15 |
P | 16 |
Q | 17 |
R | 18 |
S | 19 |
T | 20 |
U | 21 |
V | 22 |
W | 23 |
X | 24 |
Y | 25 |
Z | 26 |
The JSON for the GetTableData:
{"jsonrpc":"2.0","id":4,"result":{"qData":[{"qValue":[{"qText":"A","qNumber":0},{"qText":"1","qIsNumeric":true,"qNumber":1}]},{"qValue":[{"qText":"B","qNumber":0},{"qText":"2","qIsNumeric":true,"qNumber":2}]},{"qValue":[{"qText":"C","qNumber":0},{"qText":"3","qIsNumeric":true,"qNumber":3}]},{"qValue":[{"qText":"D","qNumber":0},{"qText":"4","qIsNumeric":true,"qNumber":4}]},{"qValue":[{"qText":"E","qNumber":0},{"qText":"5","qIsNumeric":true,"qNumber":5}]},{"qValue":[{"qText":"F","qNumber":0},{"qText":"6","qIsNumeric":true,"qNumber":6}]},{"qValue":[{"qText":"G","qNumber":0},{"qText":"7","qIsNumeric":true,"qNumber":7}]},{"qValue":[{"qText":"H","qNumber":0},{"qText":"8","qIsNumeric":true,"qNumber":8}]},{"qValue":[{"qText":"I","qNumber":0},{"qText":"9","qIsNumeric":true,"qNumber":9}]},{"qValue":[{"qText":"J","qNumber":0},{"qText":"10","qIsNumeric":true,"qNumber":10}]},{"qValue":[{"qText":"K","qNumber":0},{"qText":"11","qIsNumeric":true,"qNumber":11}]},{"qValue":[{"qText":"L","qNumber":0},{"qText":"12","qIsNumeric":true,"qNumber":12}]},{"qValue":[{"qText":"M","qNumber":0},{"qText":"13","qIsNumeric":true,"qNumber":13}]},{"qValue":[{"qText":"N","qNumber":0},{"qText":"14","qIsNumeric":true,"qNumber":14}]},{"qValue":[{"qText":"O","qNumber":0},{"qText":"15","qIsNumeric":true,"qNumber":15}]},{"qValue":[{"qText":"P","qNumber":0},{"qText":"16","qIsNumeric":true,"qNumber":16}]},{"qValue":[{"qText":"Q","qNumber":0},{"qText":"17","qIsNumeric":true,"qNumber":17}]},{"qValue":[{"qText":"R","qNumber":0},{"qText":"18","qIsNumeric":true,"qNumber":18}]},{"qValue":[{"qText":"S","qNumber":0},{"qText":"19","qIsNumeric":true,"qNumber":19}]},{"qValue":[{"qText":"T","qNumber":0},{"qText":"20","qIsNumeric":true,"qNumber":20}]},{"qValue":[{"qText":"U","qNumber":0},{"qText":"21","qIsNumeric":true,"qNumber":21}]},{"qValue":[{"qText":"V","qNumber":0},{"qText":"22","qIsNumeric":true,"qNumber":22}]},{"qValue":[{"qText":"W","qNumber":0},{"qText":"23","qIsNumeric":true,"qNumber":23}]},{"qValue":[{"qText":"X","qNumber":0},{"qText":"24","qIsNumeric":true,"qNumber":24}]},{"qValue":[{"qText":"Y","qNumber":0},{"qText":"25","qIsNumeric":true,"qNumber":25}]},{"qValue":[{"qText":"Z","qNumber":0},{"qText":"26","qIsNumeric":true,"qNumber":26}]}]}}
The JSON for the GetTablesAndKeys:
So, the GetTableAndKeys method call doesn't return columns in the correct order, but...
if I pass in a -1 for the offset in the GetTableData method call, I get the column names as the first row. At least now I get a match between data and column names (even if the column names aren't strictly in the same order).
Thanks, this was very helpful!