Help! Calculation using two datasets (collections)

Hi
Hopefully a simple request - I want to calculate values based on inputs from two datasets.

I have two simple datasets (1) just has Name and Number of Units and (2) Unit Price. I want to create a table that calculates the Total Value of Units for each Name, i.e. for each Name in the first dataset, I want to calculate Number of Units x Unit Price (where the Unit Price is the last value added in the Unit Price dataset).

Rather than a hard coded figure (2 in the below), I want a variable based on a different dataset
export function Member_Data_afterQuery(item, context) {
//TODO: write your code here…
const Unit = item.units * 2 ;
item.UnitValue = Unit;
return item;
}

I’ve got the code to make the table work.
$w.onReady( function () {
const currentColumns = $w(“#tblMemberData”).columns;
const calculatedColumns = [{
“id”: “colUnitValue”,
“dataPath”: “UnitValue”,
“label”: “Value of units”,
“type”: “string”,
}];
$w(“#tblMemberData”).columns = currentColumns.concat(calculatedColumns);
})

Thanks in advance for any help!
Will

Hey did you ever figure out how to complete something like this by anychance?

What I would like to do is I have one datacollection called

DataCollectionOne: Screenprinting_Prices

Here is what it looks like


DataCollectionTwo: Apparel


Now what i would like to do is create a third data-collection for a total printing price for that one specific shirt
as you can see the shirt price is $2 in the Price field

DataCollectionThree: GildanG200_Printing

i would like a program backend code for DataCollectionThree that will take and store GildanG200 Shirt price and add it to all the screen-printing prices