Welcome! Log In Create A New Profile

Advanced

Printing a array in report

Posted by Prolay Sarkar 
Prolay Sarkar
Printing a array in report
January 26, 2009 08:20AM
Hi,

How to print a array to report table control

arr is array of 3 by 3 string
str is string = "One"+TAB+"Two"+TAB+"Three"+CR+"AA"+TAB+"AAA"+TAB+"AAA"+CR
StringToArray(str,arr)
FOR i=1 TO 2
ITEM_ITEM1 = arr[i,1]
ITEM_ITEM1 = arr[i,2]
ITEM_ITEM3 = arr[i,3]
END



Regards,
Prolay
Al
Re: Printing a array in report
January 26, 2009 10:32AM
Hello Prolay


The answer is to read through the array and use tableadd() or tableaddline() to put the data into a table.

The question is :
Why do you want to do this ?
Why put the data into an array in the first place ?

As a general comment to all new users:

Please also give details of what you are trying the achieve and the reason why you want to do the thing that is causing problems, rather than just presenting the problem in isolation.

Windev is such a different langauge to any other in the marketplace that I am sure that new users are often trying to force it to function like their old language rather than embracing its new methods.

Regards
Al
Prolay Sarkar
Re: Printing a array in report
January 26, 2009 10:54AM
Hello Al,

I am executing a sql query which is not getting executed through HexecuteSqlquery so i am using sqlexec command and its working, i get the result in SQLCol("QRY_SELECT", 1) command and i want to populate a report table control.


Hope you get my question
//////////////////////////////////////////////////////code/////////////////
ourceName is string
TestVariable is string
// Connect to a specific data source via ODBC MS ACCESS
// (note: some drivers open a file picker
// if no file is associated with this data source)
SourceName = "RAH-PC"
ConnectionNum =SQLConnect(SourceName,"ss","sql","IMPLDATA","OLEDB","SQLOLEDB")
IF ConnectionNum<>0 THEN

sSQLQuery is string = [
.................query........................
]

// Run the query
IF SQLExec(sSQLQuery, "QRY_SELECT") THEN
// First Line
SQLFirst("QRY_SELECT")
WHILE SQL.Out = False
TableAddLine(TABLE_Table1,SQLCol("QRY_SELECT", 1),SQLCol("QRY_SELECT", 2),SQLCol("QRY_SELECT", 3))

SQLNext("QRY_SELECT")
END
ELSE
SQLInfo()
Error("Error running the query", SQL.MesError)
END

// Close the query
SQLClose("QRY_SELECT")




ELSE
// The connection failed: displaying an error message
SQLInfo()
Error("The connection to the data source" + SourceName + ...
"failed."+CR+...
"Error Code: " + SQL.Error +CR+...
SQL.MesError)
END
// In any case (connection successful or not)
SQLDisconnect()

//////////////end//////////////////////

Regards,
Prolay

DerekT
Re: Printing a array in report
January 26, 2009 11:21AM
Prolay

You say 'report table control' - a table control is not available for insertion into a report so
I assume you mean a tabular report.

This being the case then use TABLE_Table1 as the data source for the report.

If you use Insert>Special>'Report on Table' button WD will do the job for you.
All you need to do is tidy up the report layout to suit your requirements.

Regards

DerekT
Prolay Sarkar
Re: Printing a array in report
January 26, 2009 12:41PM
Hello,


You say that i cannot write a report from static data like i want to print in this way.

Column_1 Column_2 Column_3
A1 A2 A3
B1 B2 B3
C1 C3 C4
D1 D2 D3


You say first i have to write these values in a table and then i have to print in a report.

Regards,
Prolay
Paulo Oliveira
Re: Printing a array in report
January 26, 2009 12:54PM
You can use the date stored in one array directly in one report.

check the help for "Report (Report editor), Report based on a programmed data source"
instead of the hread* function just add 1 to the array index and in the "Report reading" section check if it is greater than the array dimension and make the result true/false acoding to your needs.
DerekT
Re: Printing a array in report
January 26, 2009 01:24PM
Prolay

In your example you were, as far as I could see, already writing the result of your query to a table.

snip>>>>>
SQLFirst("QRY_SELECT")
WHILE SQL.Out = False
TableAddLine(TABLE_Table1,SQLCol("QRY_SELECT", 1),SQLCol("QRY_SELECT", 2),SQLCol("QRY_SELECT", 3))

snip>>>>>

What exactly are you trying to achieve?

regards

DerekT
Prolay Sarkar
Re: Printing a array in report
January 26, 2009 01:46PM
Hi,

I was doing the same way but I choose a different report type. Thanks a lot all.

Regards,
Prolay




Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: