Question 1 I have a web dialog that has an embeded grid, the dialog accepts a part number input and does some quick lookups and fills in details for some of ther other text boxes in the dialog. a submit button is clicked and the information is written to a transactions table. The submit allows for another entry to be made. (I'm not sure how to clear all of the dialog texboxes but this is not the main problem) I would like to refreash the embeded grid showing the new record that has been added. I can attach a refreash button on the the grid in Toolbar 'Action Buttons', but I don't want the user to have to do that.
Question 2 I have written Xbasic code (see below) to process the transactions generated in the process above. However, there are some problems with it. I am new to Xbasic and am not sure of the use of the args function. I did not know it functions like an array and i'm not sure if a variable like x can be used when issuing the sqlcommand. Like :recordno[x]
Thanks for any help (SORRY THIS POST NEEDS TO BE MOVED TO -APPLICATION SERVER v11 - WEB/BROWSER APPLICATIONS)
Question 2 I have written Xbasic code (see below) to process the transactions generated in the process above. However, there are some problems with it. I am new to Xbasic and am not sure of the use of the args function. I did not know it functions like an array and i'm not sure if a variable like x can be used when issuing the sqlcommand. Like :recordno[x]
Code:
FUNCTION ProcessRecs AS C ( ) dim conn as sql::connection dim sqlCommand as c dim args as SQL::Arguments dim rs as SQL::ResultSet dim ct as n args.add("whattrans",33) flag =conn.open("::name::Inventory") sqlCommand = "SELECT Transactions.Transaction_no, Transactions.Site, Transactions.SubSite, TransactionParts.Location, TransactionParts.Part_number, TransactionParts.Condition, TransactionParts.AutoInc, TransactionParts.Quantity, Transactions.UserName, Transactions.TransDate, TransactionParts.Processed FROM Transactions Transactions INNER JOIN TransactionParts TransactionParts ON Transactions.Transaction_no = TransactionParts.Transaction_no WHERE Transactions.Transaction_no = :whattrans" flag = conn.execute(sqlCommand,args) rs= conn.ResultSet recexist=rs.NextRow() while recexist ct=ct+1 recexist=rs.nextRow() end while if ct >0 flag = conn.execute(sqlCommand,args) rs= conn.ResultSet dim A_site[ct] as c dim A_subsite[ct] as c dim A_location[ct] as c dim A_partno[ct] as c dim A_autoinc[ct] as n dim A_qty[ct] as n dim A_condition[ct] as c dim A_username[ct] as c dim A_update[ct] as d dim ntot as n args.add("Site","") args.add("subsite","") args.add("location","") args.add("partno","") args.add("autoinc",0) args.add("qty",0) args.add("condition","New") args.add("username","Physical Count") args.add("update",date()) for x = 1 to ct A_site[x]=rs.data(2) A_subsite[x]=rs.data(3) A_location[x]=rs.data(4) A_partno[x]=rs.data(5) A_autoinc[x]=rs.data(7) A_qty[x]=rs.data(8) flag=rs.nextRow() next x for y = 1 to ct args.Set("site",A_site[y]) args.Set("subsite",A_subsite[y]) args.Set("location",A_location[y]) args.Set("partno",A_partno[y]) args.Set("autoinc",A_autoinc[y]) args.Set("qty",A_qty[y]) sqlCommand = "SELECT Site, SubSite, Location, Part_ID, Condition, Qty, UserName, Updated FROM NInventory WHERE Site = :site AND Subsite = :subsite AND Part_ID = :partno" flag = conn.execute(sqlCommand,args) eflag=rs.nextRow() if eflag 'record exist 'update record if A_autoinc[y]= 1 'auto increment is true increase quantity by qty ntot=rs.data(8)+A_qty[y] A_qty[y]=ntot args.Set("qty",A_qty[y]) sqlCommand = "Update NInventory set Qty = :qty, UserName = :username, Updated = :update WHERE Site = :site and Subsite = :subsite and Part_ID = :partno" flag = conn.execute(sqlCommand,args) else 'Change quantity to qty sqlCommand = "Update NInventory set Qty = :qty, UserName = :username, Updated = :update WHERE Site = :site and Subsite = :subsite and Part_ID = :partno" flag = conn.execute(sqlCommand,args) end if else 'record does not exist 'insert new record sqlCommand = "INSERT into NInventory (Site, Subsite, Location, Part_ID, Condition, QTY, UserName, Updated) Values (:site, :subsite, :location, :partno, :condition, :qty, :username, :update )" flag = conn.execute(sqlCommand,args) end if next y end if END FUNCTION