Menu
Download Free Trial

Customize field names with different names.

Hi,
My array consists of these fields : [{“legal entity“: “Entity1″,”amount“: 113,”value“: 888},{“legal entity“: “Entity2″,”amount“: 33444,”value“: 556}];
Can I customize/map the field names with different names?
Example: I wanted to display with column names with disfferent case: Legal Entity      Amount       Value
Please suggest on this.
Thanks & Regards,
Sunilkumar.V

6 answers

Public
Roman Petrusha Flexmonster June 28, 2016

Hi!

Yes, it’s possible. You can define it in the first record of JSON data:
{
    “Color”: {type: “string”},
    “M”: {type: “month”, caption: “Month”},
    “W”: {type: “week”, caption: “Week”},
    “country”: {caption: “Country”},
    “Price”: {type: “number”},
    “Discount”: {type: “number”}
}

Please look at this sample: https://jsfiddle.net/tua7owjs/37/
Regards,
  Roman

Public
kumar October 25, 2016

Hi,
 
As per the guidelines, I have made the changes into our project and deployed into server.
My requirement is just converting the attribute name to different case that’s why I am only using “caption” where I mentioned my desired name to display.
 
Example: “city” to “CITY”, “steps” to “Steps”
 
Issue:
After made that change, even numeric columns are converting to string type and we are not able to access all aggregated functions in measures section.Even, some of the string data type attributes we would like to see them as measures(like “Steps”) when we move it to measures section. But,now everything is treated as string in the component by this change.
 
Why “type” is mandatory when I convert the attribute from one case to another?
Our requirement is just converting to desired case. everything should work as expected before. Is there any possibility in the component to achieve this functionality?
 
Please look at the attached example which I have sent in an email and looking forward to hear the feedback as soon as possible.
 
Thanks & Regards,
Sunilkumar.V

Public
Iryna Kulchytska Flexmonster October 25, 2016

Hi Sunilkumar,
 
If you are using the first object in JSON array as meta object, type field is required. You can choose from the wide list of supported types described in this documentation article http://www.flexmonster.com/doc/data-types-in-json/. Please choose type “number” for numeric fields and caption parameter to change the name to the desired one as follows:

"_price": {type: "number", caption: "Price"}

In this case, all aggregated functions will be available for numeric fields in measures section.
 
Please let me know if the above approach works for you.
 
Kind regards,
Iryna

Public
kumar October 25, 2016

Hi Iryna,
[{“price”:1664,”steps”:”51″},{“price”:1190,”steps”:”113″},{“price”:174,”steps”:”117″}]
Thanks for the Response. Numeric fields are fine, no issue.
for above response, if I define like this : “steps”: {type: “number”, caption: “STEPS”}, it displays fine and treating it as measure field.
Will it affect anywhere by specifying like this?
Thanks & Regards,
Sunilkumar.V

Public
kumar October 26, 2016

Hi,
One more question.
if I don’t include any other field into meta object, it’s not binding to pivot table. so, Is all fields are mandatory to define in meta object(first object)? In below example “Steps” is not binding even though it has data. Is there any option to display “Steps” without specify it in meta object?
Example:
{
“account”:{type:”string”,”caption”:”Account”},
//”steps”:{type:”number”,”caption”:”Steps”},
“beginbalance”:{type:”number”,”caption”:”BeginBalance”}
},
{
“account”:”0001″,
“beginbalance”:174,
“steps”:”68.1,68.2,68.3″
}
Thanks & Regards,
Sunilkumar.V

Public
Roman Petrusha Flexmonster October 26, 2016

Hi Sunilkumar,

Yes, it’s necessary to define “Steps” in meta object. If you don’t want to show it the fields list please use type:hidden. I hope it will help you to resolve your problem.

Regards,
Roman

Please login or Register to Submit Answer