Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
8
Erster Beitrag:
vor 4 Jahren, 10 Monaten
Letzter Beitrag:
vor 4 Jahren, 10 Monaten
Beteiligte Autoren:
kimor, Allard, Piet van Zanten, Gianni Spano, Fabrice Harari

[Solved] [WD18] Skipping/removing rows/lines in a report

Startbeitrag von kimor am 18.10.2013 10:06

Hi All!

I have a program with a table where you choose what you want to be in the report with a checkbox.
The report is linked to the table.
I can't use a query since the checkbox is not in the database table.
In the BODY section (code) of the report i have tabledelete to delete the rows that don't have the checkbox checked.
That deletes the non checked rows in the actual database table, which it should not. The Table control is not linked to the
database table.

Is there a better way to print out the rows that are checked in a report?

Regards
/Kim

Antworten:

Re: [WD18] Skipping/removing rows/lines in a report

Hi Kim

I'm not sure what is happening in your code, but one thing is sure, if the table control is not linked to the file AND not linked to a query IN MODIFICATION MODE, than deleting rows in the control table will NOT delete anything in the file...

Another way of rpingint your report would be to base it on the control table itself, instead, then for each row check if the checkbox is checked or not and do aresult false if not

Best regards

von Fabrice Harari - am 18.10.2013 13:10

Re: [WD18] Skipping/removing rows/lines in a report

Hi

the tabledelete is deleting stuff in your file because it is liked. Problebly direct acces? If you fill the table bij programming than tabledelete will onley remove a row in the table Hdelete() will delete a row in your datatable.

I think you better make a query. And in the query make a condtion.( problably with contains and a parameter) It doesnot matter that the checkbox is in the file or not. The check box can be the parameter that runs the query. I hope this makes sence

regards

Allard

PS if you profide a little more info than my solution can be in more detail

von Allard - am 18.10.2013 15:42

Re: [WD18] Skipping/removing rows/lines in a report

Hi Allard & Fabrice,

The table is not linked and is Loaded in memory.
I'll look into doing it by programmimg...

The code:
nRowNum is int = 1
FOR EACH ROW OF TABLE_Behorigheter
IF FEN_main.TABLE_Behorigheter.COL_Vald True THEN TableDelete(TABLE_Behorigheter, nRowNum) ; GOTO Restart //nRowNum = nRowNum + 1
nRowNum = nRowNum + 1
END


If I make it by a Query where will I initialize the parameter? Still in the Body section of the report.

Is there a command to skip to the next row when it reads the table before printing to the report?

Regards,
Kim

von kimor - am 19.10.2013 14:30

Re: [WD18] Skipping/removing rows/lines in a report

Hi,
WEll despite of your code I donnot really get what you want to achief?

Hexecutequery(queryname,querybydefault,parameter) is code to run a query with a parameter.

If you discribe what you want to achief in a bit more dedail I can see if I can make better comments.

Regards

Allard

von Allard - am 19.10.2013 20:26

Re: [WD18] Skipping/removing rows/lines in a report

Hello

Another solution (i always use it, in such situation.

Create a hidden table cloning/copying the original and set "Visible" to false in the new hidden table.
Then do a loop.

for j=1 to table_name..occurence.
if table_name.col_chk[j]=true then
//copy each value from the cells to same cells in the hidden table
end-if
end
then declare in the report the connection with the new table and print.

hth

Gianni

von Gianni Spano - am 19.10.2013 21:03

Re: [WD18] Skipping/removing rows/lines in a report

Hi Kim,

You can simply use the "Filter" process in the report code.
Place
RESULT MySource.col_Check
in it.

Regards,
Piet

von Piet van Zanten - am 20.10.2013 11:08

Re: [WD18] Skipping/removing rows/lines in a report

Hi All

Thanks for all your answers/suggestions.
Piets suggestion RESULT MySource.col_Check seemed to be the way to go.
Just a line and the result that I wanted.

Regards,
Kim

von kimor - am 21.10.2013 18:10
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.