ok I got it query will be :
cursor = year.ExecQuery2("select *, ? as closing from TEMP where FBOOK='ABCD'",Array As String(balance(year,"1234",paramas2)))
but my paramas1 contain some value of table like TEMP.ACCODE
sql.ExecQuery2("select *, ? as closing, ? as tot_dr , ? as tot_cr from GL where FBOOK='G001'", _
Array As String( _
f1.balance_as_on(Starter.year,accode,"2018-03-31"), _
f1.tot_dr(Starter.year,accode,Starter.ch_date1,Starter.ch_date2), _
f1.tot_cr(Starter.year,accode,Starter.ch_date1,Starter.ch_date2)))
GL is my table in sql db
I want to pass GL field in balance_as_on like balance_as_on(GL.FNAME,"2018-03-31")
Extract the fields say F1, F2 from the table with a select statement and a where clause for each record.
Use the fields F1 and F2 in the Sub MyNewDate
Iterate over each record and save to a list the result so it can be exported to Excel or inserted into a temporary table that you create.
Here are some guidelines:
B4X:
Dim MyList As List
MyList.initialize
Dim q As String = "SELECT F1, F2 from GL WHERE FBOOK='G001'"
Dim cursor1 As ResultSet = SQL1.ExecQuery(q)
Do While cursor1.Nextrow
MyList.Add(MyNewDate(cursor1.GetString("F1"), cursor1.getint("F2")))
'Then you can save the list to a file and manipulate it in Excel or even save its data to a new temporary table
Loop
cursor1.Close
Sub MyNewDate(v1 As String, v2 As Int) As String
Dim x As Long
x = DateTime.Add(DateTime.DateParse(v1), 0, 0, v2)
Return DateTime.Date(x)
End Sub
Example: F1 field has: "2018-03-31" And you want To add To it 4 days stored in F2 To come up with "2018-04-04"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.