cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Service data manipulation from datashape.

AV_10867476
7-Bedrock

Service data manipulation from datashape.

I have a service takes infotable as an argument and gets some data in the form of a datashape infotable for a piechart which are just 2 counters "open" and "closed" being displayed on the pie chart.

This is the code for the service for a better understanding:

 

let result = DataShapes.ex_NumberWithLabel_DS.CreateValues();
let buckets = {
  OPEN: 0,
  CLOSED: 0
};
let localizationstate = Resources.RuntimeLocalizationFunctions.GetEffectiveToken({
  token: "ex.mu.disposition.IssueState.CLOSED",
});
for (let i = 0; i < objectData.rows.length; i++) {
  let row = objectData.rows[i];
  if (row.workflowStatus == localizationstate) {
    buckets.CLOSED++;
  } else {
    buckets.OPEN++;
  }
}
result.AddRow({
  label: "Open",
  value1: buckets.OPEN,
  DisplayField: Resources.RuntimeLocalizationFunctions.GetEffectiveToken({
    token: "ex.mu.disposition.IssueState.OPEN",
  }),
});

result.AddRow({
  label: "Closed",
  value1: buckets.CLOSED,
  DisplayField: localizationstate,
});
 
The values of the datashape are: 
Order Name Actions Additional Info Default Value  
 
 
 
label
 
 
  
 
 
 
value1
 
 
 
 
 
 
 
value2
 
 
 
 
 
 
 
value3
 
 
 
 
 
 
 
value4
 
 
 
 
 
 
 
value5
 
 
 
 
 
 
 
DisplayField
 
So what i want to do is that, I want to build another service which takes this services data and then i can manipulate the data as per my requirement and then supply it to the pie chart. 


 

3 REPLIES 3

Hi @AV_10867476 , If you need to call this 'SubService' into 'MainService' for PieChart in the coding level, you can use Me/OtherEntity to select 'Entity' by its name where the 'SubService' was written  and you can use it for building the logic for PieChart based on the output of the subservice by storing the infovalues in 1 variable.

 

Arun_C_0-1706185314441.png

If this not helps you can you please explain your scenario in deep.

 

Thanks & Regards,

Arun C

I currently have a parent service that provides data, the data we can refer to as 'objectData,' presented in the form of an infotable. This infotable contains numerous properties. The intention is to utilize this data in various charts, such as pie charts and bar charts. To facilitate this, I aim to create a mediator service. This mediator service will retrieve 'objectData' from the parent service, allowing me to manipulate the data. Subsequently, I can transmit the modified data back to the other services responsible for populating the charts.

 

exDiag.PNG

Hi @AV_10867476 ,

 

Yes the above given scenario can be achievable by calling your "Parent Service" with all feilds & values in your mediater "Data Manipulate Service" with data manipulated for different charts by differentiating it in code level to print the output in required charts.

 

Thanks & Regards,

Arun C

 

 

Top Tags