top of page
Forum Posts
Daniel Zeagler
Aug 04, 2020
In Coding with Velo
I have a database of gift card numbers that I would like my customers to be able to search for their card number and get a balance. I've uploaded all my card number into a database (GiftCardDatabase) in wix with the "sCardNumber" and "sRemainingBalance" headers.
Any help would be awesome!
Here is the site and a card number I know to have a balance:
https://p44904.wixsite.com/giftcards2020/balance
Card Number - # 2087010042842273
Remaining Balance $32.42
I wrote the following code but when I execute the search, nothing shows up in my result table.
import wixData from "wix-data";
export function balancebutton_click(event) {
wixData.query("GiftCardDatabase")
.contains("sCardNumber", $w("#searchbox").value)
.find()
.then(res => {
$w("#resultsTable").rows = res.items;
});
$w.onReady(function () {
$w("#resultsTable").columns = [{
"id": "col1",
"sCardNumber": "Card Number",
"label": "Card Number",
"visible":true,
"type": "string",
}, {
"id": "col2",
"sRemainingBalance": "Remaining Balance",
"label": "Remaining Balance",
"visible":true,
"type": "string",
},];
});
}
0
12
368
Daniel Zeagler
More actions
bottom of page