Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 2 Monaten
Letzter Beitrag:
vor 2 Monaten
Beteiligte Autoren:
Ericus, Piet van Zanten, DerekT

[WB 19]Looper with Header

Startbeitrag von Ericus am 11.08.2017 10:26

Afternoon

I have a looper linked to a query.

The header is a customer code & name and the details are some documents for that customer.

I have a button in the header of the looper and when a user clicks that button I want to turn a value ON in each of the looper lines for that customer only.

Any idea how to accomplish this?

For i = 1 to loopercount will be time consuming because there are 300+ records and I only want to turn a setting on for this one customer's documents.

Thanks in advance.



Ericus Steyn

Antworten:

You could store the query result in array and bind the looper to that

When the button is clicked you update the array and redisplay the the result

FOR EACH Customer OF arrCustomers WHERE PK_Customer = "Value"
// Update a flag on the record in the array
END

LooperDisplay(lprCustomer)


OK a bit more code is required if you need to be on same row at the end of the process but this would run very quickly.
You could even sort the array so all selected customers appear at the top etc.

von DerekT - am 11.08.2017 12:40
Hi Ericus,

I'm assuming the looper groups the customers since you have a header.
So all you have to do is a looperseek on the client id and set the value on for each line from there until you reach the next customer or the end of the looper.

n=Looperseek(ATT_ID,MyClientID)
IF n>0 THEN
LOOP
ATT_Flag[n]=True
n++
IF n>LooperCount(MyLooper) THEN BREAK
IF ATT_ID[n]MyClientID THEN BREAK
END
END

Kind regards,
Piet

von Piet van Zanten - am 11.08.2017 15:54
Eventually had to follow Derek's lead.

If you use looperseek and the break then the first row is not selected and sometimes quite a few rows in succession are skipped. Don't know why.

Thanks for all suggestion.

von Ericus - am 17.08.2017 09:19
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.