How can I add multiple datasources to another datasource?
How can I add multiple datasources to another datasource?
![byoungman](https://secure.gravatar.com/avatar/2f765b8ca947ccd430103ff3ecb6e329/?default=https%3A%2F%2Fvanillicon.com%2F2f765b8ca947ccd430103ff3ecb6e329_200.png&rating=g&size=120)
I have an Angular component that the UX designer has turned over to me with base functionality present. The way that he wrote the component is to have a DataTable display data from a single datasource api endpoint call. The issue is that I actually need data from 2 other endpoint calls.
This is the primary datasource call and the row information is coming from this call
this.dataSource = await this.apiclient.callAPIMethodPOST(`masterdata/job/${xxxx}/task/${xxxx}/listrows`, {});
The other 2 datasources that I need to pull data from are because there are keys in the first dataset that I need to join to the information in these 2 calls so I can display the descriptive names instead of the codes.
this.crsInfo = await this.apiclient.callAPIMethod('masterdata/crs_list');
this.naicsInfo = await this.apiclient.callAPIMethod('masterdata/naics_list');
Thanks,
Bill
This question has an accepted answers - jump to answer
Answers
Sounds like you will need to create a new end point or update
listrows
that can join the descriptive names fromcrs_list
andnaics_list
with the data fromlistrows
and return one result to Datatables. Then you can change the Datatables columns that display the codes to display the descriptive names instead.Kevin
kthorngren,
Thanks for the quick response. I just had a conversation with the developer for the backend api and we came to the decision that the best way to do this is to refactor the primary endpoint to grab all of the information that is needed there and send it back and then all that has to be done is to format the column display names / data accordingly - a much simpler and more efficient way of addressing this issue.