PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → How code is executed
How code is executed
Débuté par Guy Bernard, 12 sep. 2012 00:08 - 4 réponses
Membre enregistré
18 messages
Posté le 12 septembre 2012 - 00:08
Greetings -
I am a "green as grass" WinDEV rookie, with many years of development experience, adding WinDEV.mobile to my bag-of-tricks to provide smart-phone functionality to applications. Proving once-again that I'm "dumber than a box of rocks" I have a question that I hope will let me make some more progress.

I don't find any documentation concerning "logic-flow" to determine when code placed in a code/embed point is executed. For example:
A looper runs from a data-file and for each record in that file I want to retrieve data from a couple of other files, add summary value entries to the looper entry and then display/re-display the looper line.
- I am using the FOR EACH ... instruction but my entries are omitted from the display, is it because I'm using the wrong code point?
- I have displayed an info.message and I see that the values are being developed and are being placed in the looper entry, they just aren't displayed.
I've tried a program loaded looper and a looper over a query and no luck with either approach.

I want to set these entries as the looper is loaded and then re-fresh them any time a new entry is made to the data-set.

Thanks in advance
Guy
Posté le 02 octobre 2012 - 15:37
The best way to learn how a looper works is to start by using one that is automatically filled from a data file (select that option on your looper).

That way you don't need to use a FOR/EACH. If you want to fill it manually, then you can use that loop construct.

You can manipulate the values before being dispayed in the onRowDisplay event of the looper which is called right before each row is drawn.
Membre enregistré
18 messages
Posté le 04 octobre 2012 - 22:02
Hi Chris -
Thanks for the info.

I have not found any documentation on the what events do what and when they are fired. Now that you've given me some direction I'll go back and do some more digging, PLUS I can get back to getting the Looper to do what I want.

If I stub my toe again, I'll be back with my begging-cup.

Thanks again
Guy

Chris du Toit wrote in news message <bc978507db2b2459291e872f8a2e7168@news.pcsoft>:
The best way to learn how a looper works is to start by using one that is automatically filled from a data file (select that option on your looper).

That way you don't need to use a FOR/EACH. If you want to fill it manually, then you can use that loop construct.

You can manipulate the values before being dispayed in the onRowDisplay event of the looper which is called right before each row is drawn.
Membre enregistré
18 messages
Posté le 08 octobre 2012 - 21:21
Hi Chris -
Being a man of my word, here I stand with hat in hand hoping you can provide me some further direction. I feel like I'm getting close, but that is not enough.
I did find the "Processes associated with the Looper controls" section in the documentation which helped

I've a query over a 4 record file, I want to see the date which is linked to the date-field in the file record, and the day-of-the-week which I'll place in the record with my code

File record dates are 09/20/2012 08/18/2012 07/12/2012 07/11/2012
my code is in the ..Row Display of Loop_QRY_TxnDay_Summary.. event/embed-point

// Load the Loop.DayOfWeek field
sLcl_DateString is string
sLcl_DateString = DateToString(QRY_TxnDay_Summary.PTX_TxnDate,"YYYYMMDD")
Info(sLcl_DateString)

SWITCH DateToDay(QRY_TxnDay_Summary.PTX_TxnDate)
CASE 1: QRY_TxnDay_Summary.PTX_TxnDate_DOW = "MOmo"
CASE 2: QRY_TxnDay_Summary.PTX_TxnDate_DOW = "TUtu"
CASE 3: QRY_TxnDay_Summary.PTX_TxnDate_DOW = "WEwe"
CASE 4: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "THth"
CASE 5: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "FRfi"
CASE 6: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "SAsa"
CASE 7: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "WNsn"
OTHER CASE: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "????"
END

Each of the dates is displayed in the Info-message, but the query list looks like this
.. 09/20/2012 THth
.. 08/18/2012
.. 07/12/2012
.. 07/11/2012

The 9/20/2012 Thursday is right, the other dates ARE shown in the Info-message and in the list but have no day of the week shown.

Any input will be GREATLY appreciated.
Guy

Chris du Toit wrote in news message <bc978507db2b2459291e872f8a2e7168@news.pcsoft>:
The best way to learn how a looper works is to start by using one that is automatically filled from a data file (select that option on your looper).

That way you don't need to use a FOR/EACH. If you want to fill it manually, then you can use that loop construct.

You can manipulate the values before being dispayed in the onRowDisplay event of the looper which is called right before each row is drawn.
Membre enregistré
18 messages
Posté le 09 octobre 2012 - 22:15
BINGO! I got it.
Doing some digging around I stumbled over a thread labeled "Image inside of a LOOPER (WebDev XII)" from back in 2008 which got me going.

I now get what I want - the code in the "Row Display of LOOP_QRY_TxnDay_Summary" event/embed . . . looks like this

sLcl_DateString is string
sLcl_DateString = DateToString(QRY_TxnDay_Summary.PTX_TxnDate,"YYYYMMDD")
Info(sLcl_DateString)
nLCL_LooperRow is int
nLCL_LooperRow = LOOP_QRY_TxnDay_Summary
SWITCH DateToDay(QRY_TxnDay_Summary.PTX_TxnDate)
CASE 1: LOOP_QRY_TxnDay_Summary[nLCL_LooperRow].PTX_TxnDate_DOW = "MOmo"
CASE 2: LOOP_QRY_TxnDay_Summary[nLCL_LooperRow].PTX_TxnDate_DOW = "TUtu"
CASE 3: LOOP_QRY_TxnDay_Summary[nLCL_LooperRow].PTX_TxnDate_DOW = "WEwe"
CASE 4: LOOP_QRY_TxnDay_Summary[nLCL_LooperRow].PTX_TxnDate_DOW = "THth"
CASE 5: LOOP_QRY_TxnDay_Summary[nLCL_LooperRow].PTX_TxnDate_DOW = "FRfi"
CASE 6: LOOP_QRY_TxnDay_Summary[nLCL_LooperRow].PTX_TxnDate_DOW = "SAsa"
CASE 7: LOOP_QRY_TxnDay_Summary[nLCL_LooperRow].PTX_TxnDate_DOW = "WNsn"
OTHER CASE: LOOP_QRY_TxnDay_Summary[nLCL_LooperRow].PTX_TxnDate_DOW = "????"
END

Guy Bernard wrote in news message <376f1d2f8387e97ade3eacb6660d97fe@news.pcsoft>:
Hi Chris -
Being a man of my word, here I stand with hat in hand hoping you can provide me some further direction. I feel like I'm getting close, but that is not enough.
I did find the "Processes associated with the Looper controls" section in the documentation which helped

I've a query over a 4 record file, I want to see the date which is linked to the date-field in the file record, and the day-of-the-week which I'll place in the record with my code

File record dates are 09/20/2012 08/18/2012 07/12/2012 07/11/2012
my code is in the ..Row Display of Loop_QRY_TxnDay_Summary.. event/embed-point

// Load the Loop.DayOfWeek field
sLcl_DateString is string
sLcl_DateString = DateToString(QRY_TxnDay_Summary.PTX_TxnDate,"YYYYMMDD")
Info(sLcl_DateString)

SWITCH DateToDay(QRY_TxnDay_Summary.PTX_TxnDate)
CASE 1: QRY_TxnDay_Summary.PTX_TxnDate_DOW = "MOmo"
CASE 2: QRY_TxnDay_Summary.PTX_TxnDate_DOW = "TUtu"
CASE 3: QRY_TxnDay_Summary.PTX_TxnDate_DOW = "WEwe"
CASE 4: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "THth"
CASE 5: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "FRfi"
CASE 6: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "SAsa"
CASE 7: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "WNsn"
OTHER CASE: LOOP_QRY_TxnDay_Summary.PTX_TxnDate_DOW = "????"
END

Each of the dates is displayed in the Info-message, but the query list looks like this
.. 09/20/2012 THth
.. 08/18/2012
.. 07/12/2012
.. 07/11/2012

The 9/20/2012 Thursday is right, the other dates ARE shown in the Info-message and in the list but have no day of the week shown.

Any input will be GREATLY appreciated.
Guy

Chris du Toit wrote in news message <bc978507db2b2459291e872f8a2e7168@news.pcsoft>:
The best way to learn how a looper works is to start by using one that is automatically filled from a data file (select that option on your looper).

That way you don't need to use a FOR/EACH. If you want to fill it manually, then you can use that loop construct.

You can manipulate the values before being dispayed in the onRowDisplay event of the looper which is called right before each row is drawn.