I am new to Alpha and I need to write data to text files.
Everything seems to be pretty straight forward but the file create function is telling me that the pointer is the wrong type of file. I realize this is probably obvious but I can't find it.
I am using the "fnum1" variable for the pointer and I set it to an number. Most basic programming languages use an integer to identify the file pointer.
Can someone please help me?
Thanks,
Patrick
Below is a program I wrote just to test the function.......
function DoDistribution as c (e as p)
' debug(1)
dim conn as SQL::Connection
dim args as sql::arguments
dim rs as sql::ResultSet
dim sqlCommand as c
dim flag as l
dim CompanyNameID as n
dim CompanyName as c
dim DistributorCompanyName as c
dim LicenseNumber as c
dim SupportExpirationDate as d
dim NewSupportExpirationDate as d
dim ProductCodeCalc as c
dim Past_Dist as c
dim Past_Company as c
dim Basic_Patrh as c
dim fnum1 as n
dim fnum2 as n
dim thefilepath as c
dim x as n
dim thetextline as c
debug(1)
conn.open("::Name::Connection1")
'Get the data from the current record that is going to be used for the header record for each quote
sqlCommand="SELECT Customers.DistributorCompanyName, Customers.CompanyName, Licenses.LicenseNumber, Licenses.ProductCodeCalc, Licenses.NewProductCalcCode FROM Customers INNER JOIN Licenses ON Customers.CompanyNameID = Licenses.CompanyID WHERE (((Licenses.DealerLicense)=False) AND ((Licenses.DemoLicense)=False) AND ((Licenses.SupportExpirationDate)>Date()))ORDER BY Customers.DistributorCompanyName, Customers.CompanyName;"
conn.Execute(sqlCommand)
'Get the results of the query and assign them to local variables
rs = conn.Resultset
CompanyName=rs.data("CompanyName")
DistributorCompanyName=rs.data("DistributorCompanyName")
LicenseNumber=rs.data("LicenseNumber")
ProductCodeCalc=rs.data("ProductCodeCalc")
fnum1.file.create("c:\test1.txt",FILE_RW_EXCLUSIVE)
for x = 1 to 2000
fnum1.write(thetextline)
rs.nextrow()
Next x
conn.close("::Name::Connection1")
end function
Everything seems to be pretty straight forward but the file create function is telling me that the pointer is the wrong type of file. I realize this is probably obvious but I can't find it.
I am using the "fnum1" variable for the pointer and I set it to an number. Most basic programming languages use an integer to identify the file pointer.
Can someone please help me?
Thanks,
Patrick
Below is a program I wrote just to test the function.......
function DoDistribution as c (e as p)
' debug(1)
dim conn as SQL::Connection
dim args as sql::arguments
dim rs as sql::ResultSet
dim sqlCommand as c
dim flag as l
dim CompanyNameID as n
dim CompanyName as c
dim DistributorCompanyName as c
dim LicenseNumber as c
dim SupportExpirationDate as d
dim NewSupportExpirationDate as d
dim ProductCodeCalc as c
dim Past_Dist as c
dim Past_Company as c
dim Basic_Patrh as c
dim fnum1 as n
dim fnum2 as n
dim thefilepath as c
dim x as n
dim thetextline as c
debug(1)
conn.open("::Name::Connection1")
'Get the data from the current record that is going to be used for the header record for each quote
sqlCommand="SELECT Customers.DistributorCompanyName, Customers.CompanyName, Licenses.LicenseNumber, Licenses.ProductCodeCalc, Licenses.NewProductCalcCode FROM Customers INNER JOIN Licenses ON Customers.CompanyNameID = Licenses.CompanyID WHERE (((Licenses.DealerLicense)=False) AND ((Licenses.DemoLicense)=False) AND ((Licenses.SupportExpirationDate)>Date()))ORDER BY Customers.DistributorCompanyName, Customers.CompanyName;"
conn.Execute(sqlCommand)
'Get the results of the query and assign them to local variables
rs = conn.Resultset
CompanyName=rs.data("CompanyName")
DistributorCompanyName=rs.data("DistributorCompanyName")
LicenseNumber=rs.data("LicenseNumber")
ProductCodeCalc=rs.data("ProductCodeCalc")
fnum1.file.create("c:\test1.txt",FILE_RW_EXCLUSIVE)
for x = 1 to 2000
fnum1.write(thetextline)
rs.nextrow()
Next x
conn.close("::Name::Connection1")
end function
Comment