How can I add multiple datasources to another datasource?

How can I add multiple datasources to another datasource?

byoungmanbyoungman Posts: 14Questions: 2Answers: 0

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

  • kthorngrenkthorngren Posts: 21,391Questions: 26Answers: 4,961
    edited September 2023 Answer ✓

    Sounds like you will need to create a new end point or update listrows that can join the descriptive names from crs_list and naics_list with the data from listrows and return one result to Datatables. Then you can change the Datatables columns that display the codes to display the descriptive names instead.

    Kevin

  • byoungmanbyoungman Posts: 14Questions: 2Answers: 0

    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.

Sign In or Register to comment.