I am new to programming and tabulator. I have a PHP page that is displaying my JSON result. I simply want to view this result in a tabulator table on a different page.
The JSON result is formatted like this, it is on a page called proxystatus.php.
{ "0": {
"hostid": "10610",
"proxy_hostid": "10609",
"host": "PIDMPRX-DEV",
"status": "0",
"disable_until": "0",
"error": "",
"available": "1",
"errors_from": "0",
"lastaccess": "0",
"ipmi_authtype": "-1",
"ipmi_privilege": "2",
"ipmi_username": "",
"ipmi_password": "",
"ipmi_disable_until": "0",
"ipmi_available": "0",
"snmp_disable_until": "0",
"snmp_available": "1",
"maintenanceid": "0",
"maintenance_status": "0",
"maintenance_type": "0",
"maintenance_from": "0",
"ipmi_errors_from": "0",
"snmp_errors_from": "0",
"ipmi_error": "",
"snmp_error": "",
"jmx_disable_until": "0",
"jmx_available": "0",
"jmx_errors_from": "0",
"jmx_error": "",
"name": "0955-PIDM-PRX",
"flags": "0",
"templateid": "0",
"description": "0955\ \ Company Name",
"tls_connect": "1",
"tls_accept": "1",
"tls_issuer": "",
"tls_subject": "",
"tls_psk_identity": "",
"tls_psk": "",
"proxy_address": "",
"auto_compress": "1"
}}
My tabulator table code is as follows, it is on a page called dash.php
var table = new Tabulator("#proxyStatus", {
height:"100%",
layout:"fitColumns",
placeholder:"Gathering Proxy Status...",
data:'<?=$proxyStatus?>',
columns:[
{title:"Status", field:"status", sorter:"string", width:200},
{title:"Available", field:"available", sorter:"number", formatter:"progress"},
{title:"Last Access", field:"lastaccess", sorter:"string"},
{title:"Name", field:"name", formatter:"star", align:"center", width:100},
{title:"Maintenance Status", field:"maintenance_status", sorter:"string", sortable:false},
{title:"Maintenance Type", field:"maintenance_type", sorter:"date", align:"center"},
{title:"Maintenance ID", field:"maintenanceid", align:"center", formatter:"tickCross", sorter:"boolean"},
],
});
You should add all the columns in the columns array or just use autoColumns:true in the Constructor as mentioned here i made this Jsfiddle for you to understand
const table = new Tabulator("#example-table", {
height: 205, // set height of table (in CSS or here), this enables the Virtual DOM and improves render speed dramatically (can be any valid css height value)
data: tabledata1, //assign data to table
layout: "fitData", //fit columns to width of table (optional)
autoColumns: true,
});
Related
I'm trying to update a jsonb array in Postgres by replacing the entire array. It's important to note, I'm not trying to add an array to the object, but simply replace the whole thing with new values. When I try the code below, I get this error in the console
error: cannot replace existing key
I'm using Nodejs as server-side language.
server.js
//new array with new values
var address = {
"appt": appt,
"city": city,
"street": street,
"country": country,
"timezone": timezone,
"coordinates": coordinates,
"door_number": door_number,
"state_province": state_province,
"zip_postal_code": zip_postal_code
}
//query
var text = "UPDATE users SET info = JSONB_insert(info, '{address}', '" + JSON.stringify(address) + "') WHERE id=$1 RETURNING*";
var values = [userid];
//pool...[below]
users table
id(serial | info(jsonb)
And this is the object I need update
{
"dob": "1988-12-29",
"type": "seller",
"email": "eyetrinity3#test.com",
"phone": "5553766962",
"avatar": "f",
"address": [
{
"appt": "",
"city": "Brandon",
"street": "11th Street East",
"country": "Canada",
"timezone": "Eastern Standard Time",
"coordinates": [
"-99.925011",
"49.840649"
],
"door_number": "666",
"state_province": "Manitoba",
"zip_postal_code": "R7A 7B8"
}
],
"last_name": "doe",
"first_name": "john",
"date_created": "2022-11-12T19:44:36.714Z",
}
below works in db-fiddle Postgresql v15 (did not in work in v12)
specific element
update json_update_t set info['address'][0] = '{
"appt": "12",
"city": "crater",
"street": "11th Street East",
"country": "mars",
"timezone": "Eastern Standard Time",
"coordinates": [
"-99.925011",
"49.840649"
],
"door_number": "9999",
"state_province": "marsbar",
"zip_postal_code": "abc 123"
}';
whole array
update json_update_t set info['address'] = '[{
"appt": "14",
"city": "crater",
"street": "11th Street East",
"country": "mars",
"timezone": "Eastern Standard Time",
"coordinates": [
"-99.925011",
"49.840649"
],
"door_number": "9999",
"state_province": "marsbar",
"zip_postal_code": "abc 123"
}]';
I have found the answer for this. Going through some of my older apps I coded, I stumbled upon the answer. It's not JSONB_INSERT but JSONB_SET. Notice the difference. The later will replace the entire key and not insert or add to the object.
JSONB_INSERT --> insert
UPDATE users SET info = JSONB_insert(info, '{address,-1}', '" + JSON.stringify(address) + "',true) WHERE id=$1 RETURNING*
JSONB_SET --> set and replace
UPDATE users SET info = JSONB_SET(info, '{address}', '" + JSON.stringify(address) +"') WHERE id=$1 RETURNING*
I'm new to JSONPath and want to write a JSONPath-syntax that retrieves the property value only if a certain condition is met. The value I'm after is not part of an array, but I've managed to make filtering work in the following JSONPath tool: https://www.site24x7.com/tools/json-path-evaluator.html
Given the following JSON, I only want to extract the value of column2.dimValue if column2.attributeId equals B0:
{
"batchId": 279,
"companyId": "40",
"period": 202208,
"taxCode": "1",
"taxSystem": "",
"transactionDate": "2022-08-05T00:00:00.000",
"transactionNumber": 222006089,
"transactionType": "IF",
"year": 2022,
"accountingInformation": {
"account": "4010",
"column1": {
"attributeId": "H9",
"dimValue": "76"
},
"column2": {
"attributeId": "B0",
"dimValue": "2170103"
},
"column3": {
"attributeId": "",
"dimValue": ""
},
"column4": {
"attributeId": "BF",
"dimValue": "217010330"
},
"column5": {
"attributeId": "10",
"dimValue": "3101"
},
"column6": {
"attributeId": "06",
"dimValue": ""
},
"column7": {
"attributeId": "19",
"dimValue": "K"
}
},
"categories": {
"cat1": "H9",
"cat2": "B0",
"cat3": "",
"cat4": "BF",
"cat5": "10",
"cat6": "06",
"cat7": "19",
"dim1": "76",
"dim2": "2170103",
"dim3": "",
"dim4": "217010330",
"dim5": "3101",
"dim6": "",
"dim7": "K"
},
"amounts": {
"amount": 48.24,
"amount3": 0.0,
"amount4": 0.0,
"currencyAmount": 48.24,
"currencyCode": "NOK",
"debitCreditFlag": 1
},
"invoice": {
"customerOrSupplierId": "58118",
"description": "",
"externalArchiveReference": "",
"externalReference": "2170103",
"invoiceNumber": "220238522",
"ledgerType": "P"
},
"additionalInformation": {
"number": 0,
"orderLineNumber": 0,
"orderNumber": 0,
"sequenceNumber": 1,
"status": "",
"value": 0.0,
"valueDate": "2022-08-05T00:00:00.000"
},
"lastUpdated": {
"updatedAt": "2022-09-05T10:59:11.633",
"updatedBy": "HELVES"
}
}
I've used this JSONPath-syntax:
$['accountingInformation']['column2'][?(#.attributeId=='B0')].dimValue
This gives the following result:
[
"2170103"
]
I'm using this result in Azure Data Factory mapping, and it seems that it doesn't work as the result is an array.
Can anyone help me with the syntax to it only returns the actual value? Is that even possible?
I repro'd the same and below is the approach.
Sample Json file is taken as in below image as a source in lookup activity.
If activity is taken to filter the value of column2 with attributeId='B0'. Expression is given as below
#equals(activity('Lookup1').output.value[0].accountingInformation.column2.attributeId ,'B0')
In true case of IF activity, Set Variable is added. New Variable with string type is taken and it is set using below expression.
#activity('Lookup1').output.value[0].accountingInformation.column2.dimvalue
Then Copy activity is added next to IF activity sequentially. In source dummy dataset is taken. +New is click in additional columns
Name: col1
Value: #variables('v2')
In Mapping, Import schemas is clicked. All other columns except the additional column that is added in source are deleted.
Pipeline is debugged and data is copied to sink without error.
I am using this api to search jack related data in city los gotas:
https://api.foursquare.com/v2/venues/search?near=los+gatos&query=jack&oauth_token=OUTH_TOKEN&v=20150728&categoryId=4d4b7105d754a06376d81259,4bf58dd8d48988d1fa931735,4bf58dd8d48988d10c941735,4bf58dd8d48988d1ea941735,4bf58dd8d48988d112941735&sortByDistance=1
but it also gives me data those are not relevant to that city. here is the output:
{
"vName": "Jack Barry and Associates",
"vFourSquareID": "4f32c93919836c91c7fa7874",
"enhance": "0",
"vLogo": "",
"bigthumb_logo": "",
"compressthumb_logo": "",
"vBanner": "",
"bigthumb_banner": "",
"compressthumb_banner": "",
"iBarID": "-1",
"tAddress": "Milpitas",
"dLat": "37.425211",
"dLong": "-121.866708",
"distance": "0",
"formatted_address": "2143 Incline Ct,Milpitas, CA 95035"
},
{
"vName": "Jack O'Neill Lounge",
"vFourSquareID": "52df337a498e8f50b076f933",
"enhance": "0",
"vLogo": "",
"bigthumb_logo": "",
"compressthumb_logo": "",
"vBanner": "",
"bigthumb_banner": "",
"compressthumb_banner": "",
"iBarID": "-1",
"tAddress": "Santa Cruz",
"dLat": "36.962198818189",
"dLong": "-122.02405086867",
"distance": "0",
"formatted_address": "Santa Cruz, CA 95060"
},
{
"vName": "Jack Rose Libation House",
"vFourSquareID": "52a5a18511d28dac8af3d02d",
"enhance": "0",
"vLogo": "",
"bigthumb_logo": "",
"compressthumb_logo": "",
"vBanner": "",
"bigthumb_banner": "",
"compressthumb_banner": "",
"iBarID": "-1",
"tAddress": "Los Gatos",
"dLat": "37.240493163257",
"dLong": "-122.00109243393",
"distance": "0",
"formatted_address": "18840 Saratoga Los Gatos Rd (Austin Way),Los Gatos, CA 95030"
}
in the output, first 2 results are not from los gatos city. but still it is displaying. can anyone say why?
You are searching for nearby Los Gatos, but does not specify a range. You should use radius parameter to specify a range. Try following url
https://api.foursquare.com/v2/venues/search?near=Los+Gatos&radius=5000&query=jack&oauth_token=(YOUR_TOKEN)&v=20150728&categoryId=4d4b7105d754a06376d81259,4bf58dd8d48988d1fa931735,4bf58dd8d48988d10c941735,4bf58dd8d48988d1ea941735,4bf58dd8d48988d112941735&sortByDistance=1
I have an object stored in arangodb which has additional inner objects, my current use case requires that I update just one of the elements.
Store Object
{
"status": "Active",
"physicalCode": "99999",
"postalCode": "999999",
"tradingCurrency": "USD",
"taxRate": "14",
"priceVatInclusive": "No",
"type": "eCommerce",
"name": "John and Sons inc",
"description": "John and Sons inc",
"createdDate": "2015-05-25T11:04:14+0200",
"modifiedDate": "2015-05-25T11:04:14+0200",
"physicalAddress": "Corner moon and space 9 station",
"postalAddress": "PO Box 44757553",
"physicalCountry": "Mars Sector 9",
"postalCountry": "Mars Sector 9",
"createdBy": "john.doe",
"modifiedBy": "john.doe",
"users": [
{
"id": "577458630580",
"username": "john.doe"
}
],
"products": [
{
"sellingPrice": "95.00",
"inStock": "10",
"name": "School Shirt Green",
"code": "SKITO2939999995",
"warehouseId": "723468998682"
},
{
"sellingPrice": "95.00",
"inStock": "5",
"name": "School Shirt Red",
"code": "SKITO245454949495",
"warehouseId": "723468998682"
},
{
"sellingPrice": "95.00",
"inStock": "10",
"discount": "5%",
"name": "School Shirt Blue",
"code": "SKITO293949495",
"warehouseId": "723468998682"
}
]
}
I want to change just one of the products stock value
{
"sellingPrice": "95.00",
"inStock": "10",
"discount": "5%",
"name": "School Shirt Blue",
"code": "SKITO293949495",
"warehouseId": "723468998682"
}
Like update store product stock less 1 where store id = x, something to this effect
FOR store IN stores
FILTER store._key == "837108415472"
FOR product IN store.products
FILTER product.code == "SKITO293949495"
UPDATE product WITH { inStock: (product.inStock - 1) } IN store.products
Apart from the above possibly it makes sense to store product as a separate document in collection store_products. I believe in NOSQL that is the best approach to reduce document size.
Found answer
here arangodb-aql-update-single-object-in-embedded-array and there
arangodb-aql-update-for-internal-field-of-object
I however believe it is best to maintain separate documents and rather use joins when retrieving. Updates easily
Thanks for the tip on how to Create An Active Hyperlink From a Datafield. Can the link style be customized? I do not wish to have a border and would like to change its font to match rest of my document.
Not sure if the community site is still active. So posting here.
Thanks in advance.
Naresh
Using the SOAP API, you can specify the font style, color, and size of text within a data field by using the following properties within the Tab element in the API Request:
<Tab>
...
<Font>Arial or ArialNarrow or Calibri or CourierNew or Garamond or Georgia or Helvetica or LucidaConsole or Tahoma or TimesNewRoman or Trebuchet or Verdana</Font>
<FontColor>Black or BrightBlue or BrightRed or DarkRed or DarkGreen or Gold or Green or NavyBlue or Purple or White</FontColor>
<FontSize>Size7 or Size8 or Size9 or Size10 or Size11 or Size12 or Size14 or Size16 or Size18 or Size20 or Size22 or Size24 or Size26 or Size28 or Size36 or Size48 or Size72</FontSize>
...
</Tab>
For more information about these properties, see the DocuSign SOAP API guide (http://www.docusign.com/sites/default/files/DocuSignAPI_Guide.pdf).
As specified in the Community forum (http://community.docusign.com/t5/Templates-and-Powerforms/Hyperlink-in-contract/td-p/25837), it's not currently possible to remove the border around the hyperlink.
If using the DocuSign Web Console, as Kim has mentioned you should be using DocuSign's internal community for such questions, but you can simply edit the font settings of the data field to match your document settings.
If sending through the API, which is what the DocuSignAPI tag on Stack Overflow is used for (i.e. api and development questions), then you can set the font settings of your datafield through an API call. In the DocuSign REST API, data fields are called "textTabs" and the three that related to font settings are:
"font": "arial",
"fontColor": "black",
"fontSize": "size12",
The full body of a textTab has the following potential properties that you can include:
"textTabs": [{
"anchorString": null,
"anchorXOffset": null,
"anchorYOffset": null,
"anchorIgnoreIfNotPresent": null,
"anchorUnits": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"documentId": "1",
"pageNumber": "1",
"recipientId": "1",
"templateLocked": false,
"templateRequired": false,
"xPosition": "24",
"yPosition": "153",
"bold": false,
"font": "arial",
"fontColor": null,
"fontSize": null,
"italic": false,
"tabLabel": "Data Field 13",
"underline": false,
"concealValueOnDocument": false,
"disableAutoSize": false,
"locked": false,
"name": "Text",
"required": true,
"value": "",
"width": 42,
"mergeFieldXml": "",
"requireInitialOnSharedChange": false,
"shared": false,
"validationMessage": "",
"validationPattern": "",
"height": 11,
"isPaymentAmount": false
}]
http://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm