top of page
Forum Posts
Shiro Tenshi
Jan 14, 2018
In Coding with Velo
I want to make notification to user when item in database decrease to limit value. Anyone can advice me.
0
4
56
Shiro Tenshi
Jan 05, 2018
0
4
1k
Shiro Tenshi
Dec 28, 2017
In Coding with Velo
When i click update button "ปรับปรุง" i need value in table change after data update to DB. How to made it? If wix feature can't did it, how to refresh my page after update data.
0
2
796
Shiro Tenshi
Dec 09, 2017
In Coding with Velo
I need to update DB by used ID "code" to query and then update only "value" field, but it not any update in DB when i try .save it always insert not update. anyone can help me fix it. import wixData from 'wix-data'; export function button1_click(event) { let values; const inID = $w('#idSe').value; const inValue = parseInt($w('#input1').value, 10); wixData.query("ChamokInventory") .eq("code", inID) .find() .then((results) => { values = results.items[0].value; let sum = inValue + values; let newupdate = { "code": inID, "value": sum, }; if (inValue > 0) { const alert = $w('#errorText').hide(); wixData.update("ChamokInventory", newupdate) //update only "value" field .then((results2) => { let item2 = results2; const alertSuc = $w('#succMsg').show(); }) .catch((err) => { let errorMsg = err; }); } else { const alert = $w('#errorText').show(); } console.log(values);; }); // } when i try let toUpdate = { "code": inID, "value": inValue, "title":"a", "unit":"ab", "type": "abc" };
0
10
1k
Shiro Tenshi
Dec 06, 2017
In Coding with Velo
i have little problem when use query result and get input element. My input value is texbox type number 'inValue' , but when get value element it convert to string. And when i try to use direct input from query it not contain any data from query insert to DB.
0
4
545
Shiro Tenshi
Nov 30, 2017
In Coding with Velo
I need to use result from query only 'value' field and use it to calculate with input value 'input1'. how to do it. import wixData from 'wix-data'; export function button1_click(event) { const inID = $w('#idSe').value; const inValue = $w('#input1').value; let toInsert = { "code": inID, "value": inValue }; if (inValue > 0) { const alert = $w('#errorText').hide(); wixData.query("ChamokInventory") .eq("code", inID) .find() .then((results) => { console.log(results.items); // it show all data. i need only 'value' field. //and use it to calculate with input1. }); wixData.insert("ChamokInventory", toInsert) .then((results) => { let item = results; //see item below const alertSuc = $w('#succMsg').show(); }) .catch((err) => { let errorMsg = err; }); } else { const alert = $w('#errorText').show(); } }
0
4
1k
Shiro Tenshi
Nov 29, 2017
In Coding with Velo
This is my code in Update button.
I need to use input from textbox ID to search update location and textbox Value to increased value in DB.
export function button1_click(event) {
// ...
let toInsert = {
"ID": "C003", //how to get input from textbox.
"value": 10 //how to increased value in DB such as DB has value 15 then i add 10 //DB must increased value to 25.
};
wixData.insert("ChamokInventory", toInsert)
.then( (results) => {
let item = results; //see item below
} )
.catch( (err) => {
let errorMsg = err;
} );
}
0
6
4k
Shiro Tenshi
More actions
bottom of page