PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Looper Initialisation
Looper Initialisation
Débuté par SolutionJ-Reg, 27 juin 2017 15:01 - 6 réponses
Posté le 27 juin 2017 - 15:01
WB20

Hi, is there a way to load a Browser type Looper using code? Every type of statement I try and use gives an error because it can only be used in server side processes.

Cheers
Reg
Posté le 27 juin 2017 - 15:11
Hi

sure... looperaddline, by example

Best regards
Posté le 27 juin 2017 - 15:39
Looperaddline yes, but by using what source data? I can't use any HFSQL commands or constructs, that is the problem...
Posté le 27 juin 2017 - 20:00
okay

so your problem has NOTHING to do with loopers.

The question is: how to access DB records from browser code?

In that case, the answer is: there are several ways to do that, depending of your need. The most obvious is to call a server procedure with an ajaxexecute and parse the result to add in the looper.

Best regards
Posté le 27 juin 2017 - 20:10
I take your point Fabrice, poor phrasing of my actual problem.

I do know how to access DB records from browser code, but I'm still stuck. Basaically in the server procedure that I call with ajaxexecute I parse the resulting data into an array based on a structure, however when I then try to "fill" the looper, which it seems I have to do in browser code, the array containing the data is not available because it was created in a server procedure.

So I suppose my actual specific question is, when I have retrieved my DB data, where do I store it so that it is then available in a browser-side process for use with the looperaddline statement?
Posté le 27 juin 2017 - 21:37
Hi Reg,

The way I use is:
- Create a server procedure and allow it to be Ajax.
- In the procedure you gather the looperdata into a string variable like:
for all qry_SoAndSo sContent+=[RC]+qry_SoAndSo.Item1+TAB+qry_SoAndSo.Item2 .. etc end RESULT sContent
Then you use a browser procedure to AjaxExecute the server procedure and fill the looper from the string:
sContent=AjaxExecute(MyServerProcedure) for each string sLine of sContent separated by RC LooperAddLine(LOOP_Looper1,sLine) end
Kind regards,
Piet
Posté le 27 juin 2017 - 23:01
Hi Piet,

Thanks for this, it's perfect!

Cheers
Reg