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
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
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
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 https://www.flexmonster.com/doc/managing-data-presentation-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
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
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
Hi Sunilkumar,
Yes, it's necessary to define "Steps" in meta object. If you don't want to show it the Field List please use type:hidden. I hope it will help you to resolve your problem.
Regards,
Roman
Hi there,
Is it possible to set the captions for the field names using the pivot grid. You have suggested defining the names in the json but our users don't have the ability to edit the JSON directly they will only be able to use the Pivot grid editor to define their reports.
Also in my case its a little different.
[{"BusinessArea1": "Cape Town","BusinessArea1Label": "Cost Centre"}];
I would like to be able to define the Caption for BusinessArea1 to be the value of the field BusinessArea1Label. Is this possible and if so how would I achieve this using the Angular Pivot Grid component.
We are in the final stages of purchasing a license from you guys and this is a bit of a stumbling block for us as the Labels for the BusinessAreas are defined per customer of ours so we need to return it from the database as part of the model.
Regards,
Aaron
Hi Aaron,
Thank you for posting your question.
The hierarchy caption in the mapping can be changed at runtime by redefining the report with the updated mapping object:
let newReport = pivot.getReport();
newReport.dataSource.mapping.myhierarchy = {
type: "string",
caption: "New Caption"
};
pivot.setReport(newReport);
Pretty much the same way you can define the hierarchy caption to be the value of any other cell in the pivot table using the getCell()
or getSelectedCell()
API calls, for example:
let newReport = pivot.getReport();
newReport.dataSource.mapping.price = {
type: "string",
caption: pivot.getCell(3, 2).value
//OR
caption: pivot.getSelectedCell().value
};
pivot.setReport(newReport);
In case you would like to implement a more complex logic for retrieving the values of specific cells for the custom captions, we would also suggest considering the customizeCell
function for such purposes. You can find more info on the mentioned API Calls by the following link: https://www.flexmonster.com/api/methods/
We've prepared a quick sample to demonstrate some of the mentioned approaches: https://jsfiddle.net/flexmonster/7tpbxgea/
Also, we were wondering if you could tell us a little bit more about your use case where the requested functionality of setting one field's value as the other one's caption is required. This will help us understand your situation better and ensure that we provide you with the most relevant information in the future.
Thank you in advance and looking forward to hearing from you.
Best regards,
Mykhailo
Hi Aaron,
Hope you're doing well!
We are just checking in to ask if you've found our suggested solution helpful. Was it suitable for your use case? Perhaps, you have any additional questions here that you think we could help you with?
We would be happy to hear your thoughts.
Looking forward to hearing from you.
Best regards,
Mykhailo
Hi Mykhailo,
Thank you for the valuable response. I have taken a slightly different approach and rather I do a separate call to our API to retrieve a mapping object for the report based on the supplied report parameters. This is working very well except for one minor thing that perhaps you have a solution for.
I need to be able to do it through the mapping and not the customise cell option because the view is generic and can be used by multiple different report datasources.
When summing a field in the Values list it automatically displays the field on the Grid as "Total of FieldName" but I would like it to just say "FieldName". Now I found that I can do this using the calculated value where there is an option to specify the Value Name.
In my case the Value Name is dynamic depending on my parameters (as I mentioned in my previous post) so I was hoping there is perhaps an option to use the existing Caption for the Value in the Calculated Value dialog. This could be done using a Key value like #Caption as an example.
Please see my screenshot for the suggestion. In the case of the Example the Value Name would become "TTA Bucket 0-10" instead of #Caption. I cannot hardcode it to 0-10 in this dialog as that may be 0-20 or more depending on the users selection.
If this could be added as a feature request that would be great unless you have another simpler solution to suggest.
Regards,
Aaron
Hi Aaron,
Thank you for giving us some time to take a deeper look into this question.
If we understand your situation correctly, you are currently using calculated measures as a way to set a custom caption for a specific field without the "Total of" part.
If so, please note that this can simply be achieved using the showAggregationLabels
property of the Options object. This property allows you to avoid the somewhat more chunky approach with calculated measures you are currently using. Feel free to check out the following JSFIddle example demonstrating this functionality: https://jsfiddle.net/flexmonster/ecet3kw6/
However, please let us know if there is a deeper problem here that we've omitted – we will be happy to help you find a solution.
Looking forward to hearing from you.
Best regards,
Mykhailo
Hi Mykhailo,
Thank you very much. This is exactly the option I was looking for. It works exactly as I needed. Apologies for wasting your time with something so clear in the documentation.
Regards,
Aaron