Quantcast
Viewing all articles
Browse latest Browse all 3548

What is the best practice of creating calculated fields in OData model before assigning it to VizFrame?

Hi,

 

I'm wondering what is the best way dealing with use cases where you need to create calculated fields in OData before assigning it to a VizFrame's chart?

 

Imagine following use cases:

 

Use Case 1:

 

OData service returns following:

 

{    "Name": "Product I",    "Sold": 2,    "Ordered ": 10  
},  
{    "Name": "Product II",    "Sold": 8,    "Ordered ": 8  
},  
{    "Name": "Product III",    "Sold": 0,    "Ordered ": 20  
},  

 

And you would have to visualize "Order completion rate" per product which is actually the value of Ordered / Sold. For Product I that would be 2/10 = 20% for Product II 100% and for Product III 0%


So either
1. "expanding" OData model for the calculated field

 

 

{    "Name": "Product I",    "Sold": 2,    "Ordered ": 10,  "Calculated_Field_Order_Completion_Rate" : 0.2
},  
{    "Name": "Product II",    "Sold": 8,    "Ordered ": 8,  "Calculated_Field_Order_Completion_Rate" : 1
},  
{    "Name": "Product III",    "Sold": 0,    "Ordered ": 20,  "Calculated_Field_Order_Completion_Rate" : 0  
},  

 

2. or creating a JSON model which you would assign to your chart later on.

 

{    "Name": "Product I",    "Order_Completion_Rate" : 0.2
},  
{    "Name": "Product II",    "Order_Completion_Rate" : 1
},  
{    "Name": "Product III",    "Order_Completion_Rate" : 0  
},  

 

Use Case 2:

 

 

OData service returns following:


{    "Name": "Test I",    "Success" : 10,  "Failed" : 20,  "InProgress" : 30,  "Planned": 0
},  
{    "Name": "Test II",    "Success" : 10,  "Failed" : 20,  "InProgress" : 30,  "Planned": 0
},  
{    "Name": "Test II",    "Success" : 10,  "Failed" : 20,  "InProgress" : 30,  "Planned": 0
},  


And you would have to visualize is "Test's state". And  "Test's state" is calculated field of Success,Failed,InProgress,Planned.


So either somehow extending OData model for the calculated field or creating new JSON model


{    "Name": "Test II",   "State" "With Errors"
},  



How would you deal with this kind of use cases?

 


Thanks for your comments in advance.

 

Kind regards,

 

Filip


Viewing all articles
Browse latest Browse all 3548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>