Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
8
Erster Beitrag:
vor 4 Jahren, 3 Monaten
Letzter Beitrag:
vor 4 Jahren, 3 Monaten
Beteiligte Autoren:
Prolay Sarkar, DerekT, Paulo Oliveira, Al

Printing a array in report

Startbeitrag von Prolay Sarkaram 26.01.2009 07:20

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
Antworten:
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

von Al - am 26.01.2009 09:32
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 ConnectionNum0 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



von Prolay Sarkar - am 26.01.2009 09:54
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

von DerekT - am 26.01.2009 10:21
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

von Prolay Sarkar - am 26.01.2009 11:41
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.

von Paulo Oliveira - am 26.01.2009 11:54
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

von DerekT - am 26.01.2009 12:24
Hi,

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

Regards,
Prolay






von Prolay Sarkar - am 26.01.2009 12:46
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.