Also, I tried doing all of this on one page.
https://braphox.wixsite.com/website/copy-of-enterrp
But I am still getting a blank table.
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
//TODO: write your code here…=RPGoal-CurrentRP
//export function switch1_click_1(event, $w)
//import {session} from ‘wix-storage’;
//session.setItem(“key”, “value”);
import wixData from ‘wix-data’;
$w.onReady( function () {
$w(“#table1”).columns = [{
“id”: “col1”, // ID of the column for code purposes
// The field key in the collection whose data this column displays
“dataPath”: “title”,
“label”: “Title”, // The column header
“width”: 100, // Column width
“visible”: true , // Column visibility
“type”: “string”, // Data type for the column
// Path for the column if it contains a link
//“linkPath”: “link-field-or-property”
},
{
“id”: “col2”, // ID of the column for code purposes
// The field key in the collection whose data this column displays
“dataPath”: “rpValue”,
“label”: “RPValue”, // The column header
“width”: 100, // Column width
“visible”: true , // Column visibility
“type”: “Number”, // Data type for the column
// Path for the column if it contains a link
//“linkPath”: “link-field-or-property”
},
{
“id”: “col3”,
“dataPath”: “permutations”,
“label”: “Permutations”,
“width”: 100,
“visible”: true ,
“type”: “Number”,
//“linkPath”: “link-field-or-property”
} //,
// more column objects here if necessary
// …
// …
]
$w(“#button2”).hide();
});
export function button1_click_1(event, $w) {
$w(“#button1”).hide();
$w(“#button2”).show();
let toInsert = {
“begin”: $w(“#input1”).value ,
“end”: $w(“#input2”).value,
“difference”: $w(“#input2”).value-$w(“#input1”).value,
};
wixData.insert(“UserRP”, toInsert)
.then( (results) => {
let item = results;
} )
. catch ( (err) => {
let errorMsg = err;
})
}
export function button2_click(event, $w) {
//Add your code for this event here:
wixData.query('NumberOfPartslists')
.eq('rpValue', $w("dataset2").getCurrentItem()["difference"]) //<-- )attempting to get current number stored in UserRP, it is in the page as dataset 2 )
.find()
.then(res => {
$w('#table1').rows = res.items;
});
}