PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WB 19]Looper with Header
[WB 19]Looper with Header
Débuté par Ericus, 11 aoû. 2017 12:26 - 3 réponses
Posté le 11 août 2017 - 12: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
Posté le 11 août 2017 - 14:40
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.
Posté le 11 août 2017 - 17:54
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
Posté le 17 août 2017 - 11:19
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.