Hi
As a newby to ReTool and Javascript I need some help.
I use MySql to store my data and I have some tables like tblTask, tblComments and tblProducts where tblProduct has fields ProductCodes and ProductID
I have two different cases I need help with. Hope that there are anyone that can help a new beginner with this.
Case 1:
I have two tables in my db "tbltask and "tblproduct" where i whant to find the ProductID in tblproduct based on a textfield input and insert the returnd productID to tblTask.productID )
a. find the productID from tblproduct
b. insert the product ID to tblTask
What I'm thinking here:
SELECT ProductID
FROM tblProduct
WHERE ProductCode = {{Text_ProductCode.value}}
IF (ProductID >0)
Insert tblProduct.ProductID to tblTask.ProductID
ELSE
Return 'Product does not exist and can not be linked to Task'
;
I need help with how to use SELECT and then UPDATE in Retool. If somebody can help with a user guide for dummy's?
Case 2:
I have one text field "Text_ProductCode" and one picklist "Sel_Explain"
a. check if productCode is register from before else add
b. If productCode exist, check if it has the same explainID, if not update
What I'm thinking here:
SELECT CommentID, ExplainID
FROM tblComments
WHERE ProductCode = {{Text_ProductCode.value}}
IF (CommentsID >0) -- Productcode exist in the table, this will prevent duplicate rows for the same product code
[
IF (tblComment.ExplainID = {{Sel_Explain.SelectedItem.ExplainID}})
[ 'ProductCode already exist with the same explain, please reuse this.'
]
ELSE
[
Update tblcomments.explainID with {{Sel_Explain.SelectedItem.ExplainID}}
]
]
-- Insert new record
INSERT INTO tblComments (UserID, CreatedDate, ProductCode, ExplainID)
VALUES ({{UserID}}, {{moment().format('DD.MM.YYYY HH:mm:ss')}},{{Text_ProductCode.value}},{{Sel_Explain.SelectedItem.ExplainID}}) ;
;
I need help with how to use SELECT and UPDATE and Insert in Retool with IF and Else.
If somebody can help with a user guide for dummy's?
-Thore