As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I don't have error but I'm not getting any data in the fields in my JSON segment (I get data in the top level segment). What am I missing?This message has been edited. Last edited by: <Emily McAllister>,
My first idea is to create a separate master for just the JSON data, with each JSON attribute as a field and relating it to the 'main' master (for lack of a better name) by the RowID field. It's easy to create a master file on a JSON format for reference using the CAR table:
APP HOLD BASEAPP
TABLE FILE CAR
PRINT
BODYTYPE
BY COUNTRY
BY CAR
ON TABLE HOLD AS CARJSON FORMAT JSON
END
Alternatively, you could create a database view on that JSON section, provided that Oracle has features to interpret JSON (I know of another RDBMS that it does).
That's under the assumption that your JSON data is of a fixed format, with the above fields: "Server", "Owner", "Description" and "RowID".
If not, I think your chances of describing that JSON data with a master in any way are rather slim.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
You don't have an absolute parent. I copied you JSON to a file and when I created the MFD it added a dummy field. You might want to try that. BTW, I have done what you are trying to do, so it should work.
Originally posted by Wep5622: It's easy to create a master file on a JSON format for reference using the CAR table:
APP HOLD BASEAPP
TABLE FILE CAR
PRINT
BODYTYPE
BY COUNTRY
BY CAR
ON TABLE HOLD AS CARJSON FORMAT JSON
END
I'll be darned. I didn't realize JSON was a format option for a HOLD file.
Here's code that extracts the JSON data from your HOLD file example:
APP HOLD BASEAPP
TABLE FILE CAR
PRINT
BODYTYPE
BY COUNTRY
BY CAR
ON TABLE HOLD AS CARJSON FORMAT JSON
END
-HTMLFORM BEGIN
<script type="text/javascript">
function build_table() {
var recs = !IBI.FIL.CARJSON;
var body = document.getElementById("carjson");
var table = document.createElement("table");
var tableBody = document.createElement("tbody");
for (var i = 0; i < recs.records.length; i++) {
var tableRow = document.createElement("tr");
var cell = document.createElement("td");
var cellText = document.createTextNode(recs.records[i].COUNTRY);
cell.appendChild(cellText);
tableRow.appendChild(cell);
var cell = document.createElement("td");
var cellText = document.createTextNode(recs.records[i].CAR);
cell.appendChild(cellText);
tableRow.appendChild(cell);
var cell = document.createElement("td");
var cellText = document.createTextNode(recs.records[i].BODYTYPE);
cell.appendChild(cellText);
tableRow.appendChild(cell);
tableBody.appendChild(tableRow);
}
table.appendChild(tableBody);
body.appendChild(table);
table.setAttribute("border", "1");
table.setAttribute("cellpadding", "6");
}
</script>
<body id="carjson" onload="build_table()">
</body>
-HTMLFORM END
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
Originally posted by dhagen: You don't have an absolute parent. I copied you JSON to a file and when I created the MFD it added a dummy field. You might want to try that. BTW, I have done what you are trying to do, so it should work.
I added the absolute parent, but I'm still not getting any data returned. It's almost like it's missing the connection between the field containing the JSON and the JSON segment.
Is there any reliable documentation on how to set this up? The examples in the technical library aren't real clear.
Originally posted by MelissaReed: Is there any reliable documentation on how to set this up? The examples in the technical library aren't real clear.
I haven't seen any. I've done a lot with SEGSUF, but it's all been trial and error up to this point. I'll see if I can put a full example together, but I might not have the time until next week.
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
Originally posted by MelissaReed: Is there any reliable documentation on how to set this up? The examples in the technical library aren't real clear.
I haven't seen any. I've done a lot with SEGSUF, but it's all been trial and error up to this point. I'll see if I can put a full example together, but I might not have the time until next week.
Thank you for the detailed example. The problem with my need is that all of my JSON data is actually stored within a column in my table. I don't have a link like HASH to connect the two. I need it to be able to read that field and create the fields based on the structure.
Originally posted by MelissaReed: Thank you for the detailed example. The problem with my need is that all of my JSON data is actually stored within a column in my table. I don't have a link like HASH to connect the two. I need it to be able to read that field and create the fields based on the structure.
The HASH is irrelevant to the example, it is only there because I've been working on a MD5 FUSE subroutine and was testing my work and your example at the same time. Remove the HASH column from the table and MFD and it and the example still works fine.
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
Likely this is not the answer you were looking for, but I'm curious as to why you are trying to use this particular Oracle column for your report.
json format is useful for certain types of reports and data movement, but this is not what you are doing.
Rather than trying to somehow "unpack" this column - which has 4 data fields - perhaps you can go back to the original data source(s) that took those 4 data fields and squished them into this Oracle column?