EnterpriseSheet Customization

Data binding with variables



EnterpriseSheet provides data communication between sheet and customer data source. Customer data object can be binded to the cell through variable defined in the sheet.

See the following image for the general actions.

See the following image for the sequence diagram process.

Define variable in cells

See the following example how to define variable in the cell. This method will define 2 variable binded to B2 cell and B3 cell.

{sheet: 1, row: 2, col: 2, json: { data: '[Company Name]', vname:'company_name', fz: 14}},
{sheet: 1, row: 3, col: 2, json: { data: '[Street Address]', vname:'street_address'}},

We can also bind a list of values to the defined variable. See the following example, it will insert a list of description and amount value into the table (with new row inserted).

{sheet: 1, row: 14, col: 2, json: { data: "[Description]", vname:'list.description'}},
{sheet: 1, row: 14, col: 5, json: { data: "[Amount]", vname:'list.amount'}},    
'list.description': ['Service Fee', 'Labor: 5 hours @ $75/hr', 'Tax - 10%'],
'list.amount': [200.00, 375.00, 57.50]

Change vname from list.description to list_description will update a list of description and amount into the table (without new row inserted).

{sheet: 1, row: 14, col: 2, json: { data: "[Description]", vname:'list_description'}},
{sheet: 1, row: 14, col: 5, json: { data: "[Amount]", vname:'list_amount'}},    
'list_description': ['Service Fee', 'Labor: 5 hours @ $75/hr', 'Tax - 10%'],
'list_amount': [200.00, 375.00, 57.50]

Binding data to variable

Here list the example code to get a list of cell variable. Query client server to get the related values for those variables, and bind the defined variable cells with those value.


    var listVariables = SHEET_API.getCellVariables(SHEET_API_HD);
    // loop each variable and pass to server to get related value
	
    SHEET_API.setValueToVariable(SHEET_API_HD, {
        'company_name': 'Apple Inc.',
        'street_address': '1 Infinite Loop',
        'city_state_zip': 'Cupertino, CA 95014',
        'city_state_zip': 'Cupertino, CA 95014',
        'phone': '1 800-692-7753',
        'bill_to_name': 'John Doe',
        'bill_to_company_name': 'ABC Company',
        'bill_to_phone': '1 613 2222 222',
        'bill_to_email': 'info@abc.com',
        'invoice_no': '20150515001',
        'list.description': ['Service Fee', 'Labor: 5 hours @ $75/hr', 'Tax - 10%'],
        'list.amount': [200.00, 375.00, 57.50]
    });
    
    // clean the defined variable
    SHEET_API.clearAllVariables(SHEET_API_HD);
   

 

 


Copyright © FeyaSoft Inc. All rights reserved.