Get the content of a file and create a QVD file
Get the content of a file and create a QVD file by using the GetIncludeFileContent method and the SetScript method.
Example
The handle of the app is 1.
The text file CountryRegionSales.txt contains the following information:
New_Table:
LOAD * Inline
[Country, Region, Sales
SWE, EUR, 3.7
BEL, EUR, 0.4
NOR, EUR, 3.7
JAP, ASA, 3.6
CHN, ASA, 5.6
USA, NOA, 10.2];
STORE New_Table into File.qvd (qvd);
1. Get the content of the file CountryRegionSales.txt.
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "GetIncludeFileContent",
"handle": 1,
"params": ["lib://CONNECTION_NAME\\CountryRegionSales.txt"
]}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"qContent": "New_Table:\r\nLOAD * Inline\r\n[Country, Region, Sales\r\nSWE, EUR, 3.7\r\nBEL, EUR, 0.4\r\nNOR, EUR, 3.7\r\nJAP, ASA, 3.6\r\nCHN, ASA, 5.6\r\nUSA, NOA, 10.2];\r\nSTORE New_Table into File.qvd (qvd);"
}
}
The content of the file is returned.
2. Using the content of the file, write a script:
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "SetScript",
"handle": 1,
"params": [
"New_Table:\r\nLOAD * Inline\r\n[Country, Region, Sales\r\nSWE, EUR, 3.7\r\nBEL, EUR, 0.4\r\nNOR, EUR, 3.7\r\nJAP, ASA, 3.6\r\nCHN, ASA, 5.6\r\nUSA, NOA, 10.2];\r\nSTORE New_Table into File.qvd (qvd);"
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {},
"change": [
1
]
}
A QVD file is created and contains a table with three columns (Country, Region and Sales) and six rows.