Convert Json file HTML report

I am working on showing the .json format to be rendered as HTML. I have attached the json file i am using. I need some HTML converter to show  the entire .json file in a report format in HTML.

so for example in the attached .json should  be rendered as HTML report
a) The title of the HTML report would be the 'Contractor name' i.e. 'Sample Contractor'
b) The body of the HTML Report should : list the values in the tag 'phone number', 'Environmental concerns', 'Weather _conditions' etc.
c)  The body of the HTML Report should also : Show the image under the 'attachment' tag
d) The footer of the  HTML should: list the values in the 'Inspector_name'
Star79Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nitin SontakkeDeveloperCommented:
There is no attachment. Furthermore, it typically helps if you create a mock-up either in MS-Excel or MS-Word or anything which will give a visual representation (if you can, of course!).
0
Vijaya KumarCommented:
Try this sample code, change dataJSON based on your requirement.

<html>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<head>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">		
<link rel="stylesheet" href="//cdn.datatables.net/plug-ins/1.10.16/features/searchHighlight/dataTables.searchHighlight.css">		
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/1.0.7/css/responsive.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/responsive/1.0.7/js/dataTables.responsive.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://bartaz.github.io/sandbox.js/jquery.highlight.js"></script>	
<script src="https://cdn.datatables.net/plug-ins/1.10.16/features/searchHighlight/dataTables.searchHighlight.min.js"></script>	
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/pdfmake.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
	var dataJSON = [{"c_name":"abc","ph_no":"5755","weather":"cloudy"},
					{"c_name":"xyx","ph_no":"123456","weather":"cloudy"},
					{"c_name":"abgfhc","ph_no":"x545yz","weather":"cloudy"},
					{"c_name":"gfhh","ph_no":"xy4545z","weather":"cloudy"},
					{"c_name":"afghfghbc","ph_no":"45454","weather":"cloudy"}];
    $('#sample').DataTable( {
        dom: 'Bfrtip',
		"aaData": dataJSON,
		"aoColumns": [
					{ "mDataProp": "c_name" },
					{ "mDataProp": "ph_no" },
					{ "mDataProp": "weather" },
					],
            buttons: [
            {
                extend: 'excelHtml5',
                title: 'Report',
				
			},
            {
                extend: 'pdfHtml5',
                title: 'Report',
				
			},
			]
    } );
} );
</script>
</head>
<body>
<table id="sample">
	<thead>
  <tr>
    <th>Contractor name</th>
    <th>Phone number</th>
    <th>Weather _conditions</th>
  </tr>
  </thead>

</table>
</body>
</html>

Open in new window

0
Star79Author Commented:
This is something I am looking for @vijaya kumar. The  HTML looks good but the only issue is Json structure what I have very unstructured. See the attached but regardless I work on tweaking the HTML.  Will keep you posted....
forms.txt
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Vijaya KumarCommented:
Check this out result from your JSON

<html>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<head>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">		
<link rel="stylesheet" href="//cdn.datatables.net/plug-ins/1.10.16/features/searchHighlight/dataTables.searchHighlight.css">		
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/1.0.7/css/responsive.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/responsive/1.0.7/js/dataTables.responsive.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://bartaz.github.io/sandbox.js/jquery.highlight.js"></script>	
<script src="https://cdn.datatables.net/plug-ins/1.10.16/features/searchHighlight/dataTables.searchHighlight.min.js"></script>	
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/pdfmake.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
	var dataJSON = [{"_notes":[],"Traffic_Control_Barriers_and_Signs":"no","_bamboo_dataset_id":"","_tags":[],"Contractor":"Sample Contractor","group_yd9ga61":[{"group_yd9ga61/Photo":"1963 willys pickup-16_45_22.jpg","group_yd9ga61/Description":"Jeep"}],"phonenumber":"phonenumber not found","_xform_id_string":"asDY73nxAyeSEBD5iq3f8t","meta/instanceID":"uuid:db58e274-942d-4103-bf28-91d1ee3c0c52","One_Calls_Made":"yes","Environmental_concerns":"NA","end":"2018-03-12T16:45:52.262-04:00","Weather_Conditions":"Sunny, 70 F","Abnormal_work_conditions_observed":"no","start":"2018-03-12T16:43:12.366-04:00","Project_Job_":"123456","_attachments":[{"mimetype":"image/jpeg","download_url":"https://kobocat-s3.s3.amazonaws.com/abc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/db58e274-942d-4103-bf28-91d1ee3c0c52/1963%20willys%20pickup-16_45_22.jpg?Signature=Og3PGmLGkkCpHr0qpoGpFV9GZgk%3D&Expires=1520891158&AWSAccessKeyId=AKIAJ6XH76JM5PGK4I7Q","filename":"abc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/db58e274-942d-4103-bf28-91d1ee3c0c52/1963 willys pickup-16_45_22.jpg","instance":9076526,"id":2623160,"xform":161693}],"Remarks":"NA","_status":"submitted_via_web","Work_date":"2018-03-12","Job_Site_Secured":"yes","Safety_Meeting_Conducted":"yes","Project_Name":"Sample Pipeline - demo","PPE_Use_Compliance":"no","_validation_status":{},"_uuid":"db58e274-942d-4103-bf28-91d1ee3c0c52","_submitted_by":null,"Project_Location":"Sample County","group_hn48q84":[{"group_hn48q84/Depth_inches":"36","group_hn48q84/From_Station_XXXX_XX":"12+23","group_hn48q84/To_Station_XXXX_XX":"12+23"},{"group_hn48q84/Depth_inches":"48","group_hn48q84/From_Station_XXXX_XX":"12+23","group_hn48q84/To_Station_XXXX_XX":"12+23"}],"formhub/uuid":"f9d6beb196714ef5ad54bbcb87e948ea","__version__":"vEyrVvEJHbXRtTW9hTE49G","_submission_time":"2018-03-12T20:45:58","group_sm7lp26":[{"group_sm7lp26/Pay_Item":"silt_fence","group_sm7lp26/Footage":"300","group_sm7lp26/Location_XXXX_XX_001":"12+23"}],"_geolocation":[null,null],"group_if8un87":[{"group_if8un87/Owner_name":"US Power","group_if8un87/Crossing_Type":"power","group_if8un87/Location_XXXX_XX":"12+23"},{"group_if8un87/Owner_name":"PSEG","group_if8un87/Crossing_Type":"power","group_if8un87/Location_XXXX_XX":"12+23"}],"I_have_reviewed_and_ntained_on_this_form":"OK","_id":9076526,"Inspector_Name":"abc"},{"_notes":[],"Work_Site_Housekeeping":"yes","_bamboo_dataset_id":"","_tags":[],"Contractor":"Sample Contractor","group_yd9ga61":[{"group_yd9ga61/Photo":"2010PortlandCover_300-11_36_28.jpg","group_yd9ga61/Description":"kukhkluhukhkuhkulhukl"}],"_xform_id_string":"asDY73nxAyeSEBD5iq3f8t","meta/instanceID":"uuid:81785fe7-3d5a-4572-80b6-64087f8182eb","One_Calls_Made":"yes","Environmental_concerns":"khklhukuklhukhuklhukkh","end":"2018-03-08T11:36:35.321-05:00","Weather_Conditions":"Sunny, 70 F","Abnormal_work_conditions_observed":"no","start":"2018-03-08T11:35:30.228-05:00","Project_Job_":"123456","_attachments":[{"mimetype":"image/jpeg","download_url":"https://kobocat-s3.s3.amazonaws.com/chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/81785fe7-3d5a-4572-80b6-64087f8182eb/2010PortlandCover_300-11_36_28.jpg?Signature=5SVQJKliRtmRQNx%2BGYeErulaVNo%3D&Expires=1520891022&AWSAccessKeyId=AKIAJ6XH76JM5PGK4I7Q","filename":"chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/81785fe7-3d5a-4572-80b6-64087f8182eb/2010PortlandCover_300-11_36_28.jpg","instance":9076516,"id":2623159,"xform":161693}],"Remarks":"lighlhuklhkulhk","_status":"submitted_via_web","Work_date":"2018-03-08","Job_Site_Secured":"no","Safety_Meeting_Conducted":"yes","Project_Name":"Sample Pipeline","PPE_Use_Compliance":"yes","_validation_status":{},"_uuid":"81785fe7-3d5a-4572-80b6-64087f8182eb","_submitted_by":null,"Project_Location":"Sample County","group_hn48q84":[{"group_hn48q84/Depth_inches":"67","group_hn48q84/From_Station_XXXX_XX":"67","group_hn48q84/To_Station_XXXX_XX":"67"},{"group_hn48q84/Depth_inches":"56","group_hn48q84/From_Station_XXXX_XX":"567","group_hn48q84/To_Station_XXXX_XX":"56"}],"formhub/uuid":"f9d6beb196714ef5ad54bbcb87e948ea","__version__":"v9KhtWeNMxgLSdXTXoqpnW","_submission_time":"2018-03-12T20:43:42","group_sm7lp26":[{"group_sm7lp26/Quantity":"65768","group_sm7lp26/Pay_Item":"mats","group_sm7lp26/Location_XXXX_XX_001":"6567g"}],"_geolocation":[null,null],"group_if8un87":[{"group_if8un87/Owner_name":"576585","group_if8un87/Crossing_Type":"telephone","group_if8un87/Location_XXXX_XX":"76856875"}],"_id":9076516,"Inspector_Name":"abc"},{"_notes":[],"Work_Site_Housekeeping":"yes","Traffic_Control_Barriers_and_Signs":"yes","_bamboo_dataset_id":"","_tags":[],"Contractor":"Sample Contractor","group_yd9ga61":[{"group_yd9ga61/Photo":"Well-head-3-11_35_59.jpg","group_yd9ga61/Description":"Well Head is the description"}],"_xform_id_string":"asDY73nxAyeSEBD5iq3f8t","meta/instanceID":"uuid:de3e183c-19a6-4f9c-bb9c-8fa9ccf3fb03","One_Calls_Made":"yes","Environmental_concerns":"None","end":"2018-03-08T11:37:39.000-05:00","Weather_Conditions":"Sunny, 70 F","Abnormal_work_conditions_observed":"yes","start":"2018-03-08T11:30:40.000-05:00","Project_Job_":"123456","_attachments":[{"mimetype":"image/jpeg","download_url":"https://kobocat-s3.s3.amazonaws.com/chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/de3e183c-19a6-4f9c-bb9c-8fa9ccf3fb03/Well-head-3-11_35_59.jpg?Signature=18qp%2BbZsHTEMKkzvv5J20uZyusY%3D&Expires=1520530665&AWSAccessKeyId=AKIAJ6XH76JM5PGK4I7Q","filename":"chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/de3e183c-19a6-4f9c-bb9c-8fa9ccf3fb03/Well-head-3-11_35_59.jpg","instance":8991708,"id":2607530,"xform":161693}],"Remarks":"None","_status":"submitted_via_web","Work_date":"2018-03-08","Job_Site_Secured":"yes","Safety_Meeting_Conducted":"yes","Project_Name":"Project Pipeline1","PPE_Use_Compliance":"yes","_validation_status":{},"_uuid":"de3e183c-19a6-4f9c-bb9c-8fa9ccf3fb03","_submitted_by":null,"Project_Location":"Sample County","group_hn48q84":[{"group_hn48q84/Depth_inches":"100","group_hn48q84/From_Station_XXXX_XX":"12+28","group_hn48q84/To_Station_XXXX_XX":"23+28"}],"formhub/uuid":"f9d6beb196714ef5ad54bbcb87e948ea","__version__":"vbNbeGxjgDs36Xqc53PCta","_submission_time":"2018-03-08T16:37:45","group_sm7lp26":[{"group_sm7lp26/Quantity":"30","group_sm7lp26/Pay_Item":"mats","group_sm7lp26/Location_XXXX_XX_001":"12+19"}],"group_ar6rn62":[{"group_ar6rn62/To_Station_XXXX_XX_001":"14+29","group_ar6rn62/From_Station_XXXX_XX_001":"12+20"}],"_geolocation":[null,null],"group_if8un87":[{"group_if8un87/Owner_name":"Damu Katalath","group_if8un87/Crossing_Type":"power","group_if8un87/Location_XXXX_XX":"12+18"}],"_id":8991708,"Inspector_Name":"Jim forster"},{"_notes":[],"_bamboo_dataset_id":"","_tags":[],"Contractor":"Sample Contractor","group_yd9ga61":[{"group_yd9ga61/Photo":"2010PortlandCover_300-11_28_2.jpg","group_yd9ga61/Description":"jgkjhhjkgh"}],"_xform_id_string":"asDY73nxAyeSEBD5iq3f8t","meta/instanceID":"uuid:2285d04f-1508-4e63-83ea-acc95f9756ef","end":"2018-03-08T11:28:16.002-05:00","Weather_Conditions":"Sunny, 70 F","start":"2018-03-08T11:27:41.883-05:00","Project_Job_":"123456","_geolocation":[null,null],"_status":"submitted_via_web","formhub/uuid":"f9d6beb196714ef5ad54bbcb87e948ea","Project_Name":"Sample Pipeline","_validation_status":{},"_uuid":"2285d04f-1508-4e63-83ea-acc95f9756ef","_submitted_by":null,"Project_Location":"Sample County","Work_date":"2018-03-08","__version__":"v9KhtWeNMxgLSdXTXoqpnW","_submission_time":"2018-03-09T17:05:52","_attachments":[{"mimetype":"image/jpeg","download_url":"https://kobocat-s3.s3.amazonaws.com/chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/2285d04f-1508-4e63-83ea-acc95f9756ef/2010PortlandCover_300-11_28_2.jpg?Signature=Dl5fKOgfleU4GFBmh8sGcdkaeVk%3D&Expires=1520618752&AWSAccessKeyId=AKIAJ6XH76JM5PGK4I7Q","filename":"chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/2285d04f-1508-4e63-83ea-acc95f9756ef/2010PortlandCover_300-11_28_2.jpg","instance":9014609,"id":2611970,"xform":161693}],"_id":9014609,"Inspector_Name":"Inspector 1"},{"_notes":[],"_bamboo_dataset_id":"","_tags":[],"Contractor":"Sample Contractor","group_yd9ga61":[{"group_yd9ga61/Photo":"2010PortlandCover_300-11_30_40.jpg","group_yd9ga61/Description":"vchgghjfjhgfgh"}],"_xform_id_string":"asDY73nxAyeSEBD5iq3f8t","meta/instanceID":"uuid:51bb4280-c90d-4b16-802c-343567362b0b","end":"2018-03-08T11:30:42.798-05:00","Weather_Conditions":"Sunny, 70 F","start":"2018-03-08T11:30:29.105-05:00","Project_Job_":"123456","_geolocation":[null,null],"_status":"submitted_via_web","formhub/uuid":"f9d6beb196714ef5ad54bbcb87e948ea","Project_Name":"Sample Pipeline","_validation_status":{},"_uuid":"51bb4280-c90d-4b16-802c-343567362b0b","_submitted_by":null,"Project_Location":"Sample County","Work_date":"2018-03-08","__version__":"v9KhtWeNMxgLSdXTXoqpnW","_submission_time":"2018-03-09T17:05:52","_attachments":[{"mimetype":"image/jpeg","download_url":"https://kobocat-s3.s3.amazonaws.com/chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/51bb4280-c90d-4b16-802c-343567362b0b/2010PortlandCover_300-11_30_40.jpg?Signature=fGMeR0b61O2pMkyoCpPSwC8qD1c%3D&Expires=1520618752&AWSAccessKeyId=AKIAJ6XH76JM5PGK4I7Q","filename":"chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/51bb4280-c90d-4b16-802c-343567362b0b/2010PortlandCover_300-11_30_40.jpg","instance":9014610,"id":2611971,"xform":161693}],"_id":9014610,"Inspector_Name":"Inspector 1"},{"_notes":[],"Work_Site_Housekeeping":"yes","Traffic_Control_Barriers_and_Signs":"no","_bamboo_dataset_id":"","_tags":[],"Contractor":"Sample Contractor","group_yd9ga61":[{"group_yd9ga61/Photo":"A Well-head-3-12_7_59.jpg","group_yd9ga61/Description":"well profile"}],"phonenumber":"phonenumber not found","_xform_id_string":"asDY73nxAyeSEBD5iq3f8t","meta/instanceID":"uuid:1459a1ff-b7ac-4e90-939a-ea0e881d0811","One_Calls_Made":"yes","end":"2018-03-09T12:08:34.936-05:00","Weather_Conditions":"Sunny, 70 F","Abnormal_work_conditions_observed":"yes","start":"2018-03-09T12:05:22.196-05:00","Project_Job_":"123456","_attachments":[{"mimetype":"image/jpeg","download_url":"https://kobocat-s3.s3.amazonaws.com/chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/1459a1ff-b7ac-4e90-939a-ea0e881d0811/A%20Well-head-3-12_7_59.jpg?Signature=WCmZpDicoSTp55%2F6DKiyNleyzxE%3D&Expires=1520618921&AWSAccessKeyId=AKIAJ6XH76JM5PGK4I7Q","filename":"chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/1459a1ff-b7ac-4e90-939a-ea0e881d0811/A Well-head-3-12_7_59.jpg","instance":9014683,"id":2612018,"xform":161693}],"_status":"submitted_via_web","Work_date":"2018-03-09","Job_Site_Secured":"yes","Safety_Meeting_Conducted":"yes","Project_Name":"Sample Pipeline","PPE_Use_Compliance":"no","_validation_status":{},"_uuid":"1459a1ff-b7ac-4e90-939a-ea0e881d0811","_submitted_by":null,"Project_Location":"Sample County","group_hn48q84":[{"group_hn48q84/Depth_inches":"36","group_hn48q84/From_Station_XXXX_XX":"12+23","group_hn48q84/To_Station_XXXX_XX":"12+23"},{"group_hn48q84/Depth_inches":"48","group_hn48q84/From_Station_XXXX_XX":"12+23","group_hn48q84/To_Station_XXXX_XX":"12+23"}],"formhub/uuid":"f9d6beb196714ef5ad54bbcb87e948ea","__version__":"vEyrVvEJHbXRtTW9hTE49G","_submission_time":"2018-03-09T17:08:41","group_sm7lp26":[{"group_sm7lp26/Quantity":"15","group_sm7lp26/Pay_Item":"mats","group_sm7lp26/Location_XXXX_XX_001":"12+23"},{"group_sm7lp26/Pay_Item":"silt_fence","group_sm7lp26/Footage":"560","group_sm7lp26/Location_XXXX_XX_001":"12+23"}],"_geolocation":[null,null],"group_if8un87":[{"group_if8un87/Owner_name":"PSEG","group_if8un87/Diameter":"40","group_if8un87/Crossing_Type":"gas","group_if8un87/Location_XXXX_XX":"12+23"},{"group_if8un87/Owner_name":"TX Power","group_if8un87/Crossing_Type":"power","group_if8un87/Location_XXXX_XX":"12+23"}],"I_have_reviewed_and_ntained_on_this_form":"OK","_id":9014683,"Inspector_Name":"Chris abc"},{"_notes":[],"Work_Site_Housekeeping":"yes","Traffic_Control_Barriers_and_Signs":"no","_bamboo_dataset_id":"","_tags":[],"Contractor":"Sample Contractor","group_yd9ga61":[{"group_yd9ga61/Photo":"A Well-head-3-13_33_42.jpg","group_yd9ga61/Description":"well"}],"phonenumber":"phonenumber not found","_xform_id_string":"asDY73nxAyeSEBD5iq3f8t","meta/instanceID":"uuid:c665818e-efa2-4dba-a0a0-97c03af82ba7","One_Calls_Made":"yes","Environmental_concerns":"none","end":"2018-03-19T13:34:02.585-04:00","Weather_Conditions":"Sunny, 70 F","Abnormal_work_conditions_observed":"no","start":"2018-03-19T13:32:26.165-04:00","Project_Job_":"123456","_attachments":[{"mimetype":"image/jpeg","download_url":"https://kobocat-s3.s3.amazonaws.com/chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/c665818e-efa2-4dba-a0a0-97c03af82ba7/A%20Well-head-3-13_33_42.jpg?Signature=D0KC%2BYPEp5CVx262nN2Da8IRvoE%3D&Expires=1521484448&AWSAccessKeyId=AKIAJ6XH76JM5PGK4I7Q","filename":"chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/c665818e-efa2-4dba-a0a0-97c03af82ba7/A Well-head-3-13_33_42.jpg","instance":9242247,"id":2659059,"xform":161693}],"Remarks":"none","_status":"submitted_via_web","Work_date":"2018-03-19","Job_Site_Secured":"yes","Safety_Meeting_Conducted":"yes","Project_Name":"Sample Pipeline","PPE_Use_Compliance":"yes","_validation_status":{},"_uuid":"c665818e-efa2-4dba-a0a0-97c03af82ba7","_submitted_by":null,"Project_Location":"Sample County","group_hn48q84":[{"group_hn48q84/Depth_inches":"36","group_hn48q84/From_Station_XXXX_XX":"12+23","group_hn48q84/To_Station_XXXX_XX":"12+23"},{"group_hn48q84/Depth_inches":"48","group_hn48q84/From_Station_XXXX_XX":"12+23","group_hn48q84/To_Station_XXXX_XX":"12+23"}],"formhub/uuid":"f9d6beb196714ef5ad54bbcb87e948ea","__version__":"vEyrVvEJHbXRtTW9hTE49G","_submission_time":"2018-03-19T17:34:08","group_sm7lp26":[{"group_sm7lp26/Pay_Item":"silt_fence","group_sm7lp26/Footage":"345","group_sm7lp26/Location_XXXX_XX_001":"12+23"}],"_geolocation":[null,null],"group_if8un87":[{"group_if8un87/Owner_name":"Texas Power","group_if8un87/Crossing_Type":"power","group_if8un87/Location_XXXX_XX":"12+23"}],"I_have_reviewed_and_ntained_on_this_form":"OK","_id":9242247,"Inspector_Name":"abc"},{"_notes":[],"Work_Site_Housekeeping":"yes","Traffic_Control_Barriers_and_Signs":"yes","_bamboo_dataset_id":"","_tags":[],"Contractor":"Sample Contractor","group_yd9ga61":[{"group_yd9ga61/Photo":"A Well-head-3-15_3_38.jpg","group_yd9ga61/Description":"Well"}],"phonenumber":"phonenumber not found","_xform_id_string":"asDY73nxAyeSEBD5iq3f8t","meta/instanceID":"uuid:1feb20b9-2282-4f3b-a797-fb31d81e057a","One_Calls_Made":"yes","Environmental_concerns":"None","end":"2018-03-19T15:04:06.752-04:00","Weather_Conditions":"Sunny, 70 F","Abnormal_work_conditions_observed":"no","start":"2018-03-19T15:01:04.401-04:00","Project_Job_":"123456","_attachments":[{"mimetype":"image/jpeg","download_url":"https://kobocat-s3.s3.amazonaws.com/chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/1feb20b9-2282-4f3b-a797-fb31d81e057a/A%20Well-head-3-15_3_38.jpg?Signature=XuSVhUwsew7WGT4wv9PeRhpL%2FSM%3D&Expires=1521489852&AWSAccessKeyId=AKIAJ6XH76JM5PGK4I7Q","filename":"chrisabc/attachments/f9d6beb196714ef5ad54bbcb87e948ea/1feb20b9-2282-4f3b-a797-fb31d81e057a/A Well-head-3-15_3_38.jpg","instance":9243759,"id":2659665,"xform":161693}],"Remarks":"None","_status":"submitted_via_web","Work_date":"2018-03-19","Job_Site_Secured":"yes","Safety_Meeting_Conducted":"no","Project_Name":"Sample Pipeline","PPE_Use_Compliance":"no","_validation_status":{},"_uuid":"1feb20b9-2282-4f3b-a797-fb31d81e057a","_submitted_by":null,"Project_Location":"Sample County","group_hn48q84":[{"group_hn48q84/Depth_inches":"36","group_hn48q84/From_Station_XXXX_XX":"12+23","group_hn48q84/To_Station_XXXX_XX":"12+23"},{"group_hn48q84/Depth_inches":"48","group_hn48q84/From_Station_XXXX_XX":"12+23","group_hn48q84/To_Station_XXXX_XX":"12+23"}],"formhub/uuid":"f9d6beb196714ef5ad54bbcb87e948ea","__version__":"vEyrVvEJHbXRtTW9hTE49G","_submission_time":"2018-03-19T19:04:12","group_sm7lp26":[{"group_sm7lp26/Pay_Item":"silt_fence","group_sm7lp26/Footage":"345","group_sm7lp26/Location_XXXX_XX_001":"12+23"},{"group_sm7lp26/Quantity":"56","group_sm7lp26/Pay_Item":"breakers","group_sm7lp26/Location_XXXX_XX_001":"12+23"}],"_geolocation":[null,null],"group_if8un87":[{"group_if8un87/Owner_name":"Texas Power","group_if8un87/Crossing_Type":"power","group_if8un87/Location_XXXX_XX":"12+23"},{"group_if8un87/Owner_name":"HJK","group_if8un87/Diameter":"42","group_if8un87/Crossing_Type":"gas","group_if8un87/Location_XXXX_XX":"12+23"}],"I_have_reviewed_and_ntained_on_this_form":"OK","_id":9243759,"Inspector_Name":"abc"}]

    $('#sample').DataTable( {
        dom: 'Bfrtip',
		"aaData": dataJSON,
		"aoColumns": [
					{ "mDataProp": "Contractor" },
					{ "mDataProp": "Weather_Conditions" },
					{ 
					 "mDataProp": function ( data, type, full, meta) {
						if(data.phonenumber == undefined)
						{
							return 'Empty';
						}
						else
						{
							return data.phonenumber;
						}
					 } 
					},
					{ 
					 "mDataProp": function ( data, type, full, meta) {
						if(data.Environmental_concerns == undefined)
						{
							return 'Empty';
						}
						else
						{
							return data.Environmental_concerns;
						}
					 } 
					},
					],
            buttons: [
            {
                extend: 'excelHtml5',
                title: 'Report',
				
			},
            {
                extend: 'pdfHtml5',
                title: 'Report',
				
			},
			]
    } );
} );
</script>
</head>
<body>
<table id="sample">
	<thead>
  <tr>
    <th>Contractor name</th>
    <th>Weather Condtions</th>
    <th>Phone No</th>
	<th>Environmental Condtions</th>
  </tr>
  </thead>

</table>
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Star79Author Commented:
I think your  answer should  suffice. Thanks a lot.
0
Star79Author Commented:
worked like a charm. Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.