PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV Mobile 2024 → Looper?  or maybe wrong control, add data to the line
Looper? or maybe wrong control, add data to the line
Iniciado por Guy Bernard, ago., 29 2012 8:51 PM - 4 respostas
Membro registado
18 mensagems
Publicado em agosto, 29 2012 - 8:51 PM
I am a "PURE ROOKIE" when it comes to WinDEV, with many years of software development background, and REALLY FRUSTRATED!
working in WinDEV.mobile-17, for the Android.OS
I need to present a window with a list of the dates on which transactions have been entered. The Tx-entry function add a record to the TX_Dates file so there is a record in TX_Dates for every date on which a transaction is entered.

I'm using a Looper control (the List-View and Table controls are not available for selection) built over a query built over the TX_Dates file
The dates are presented just fine. Now I want to add some totals to the dates which is a summation of the Tx-data
The line should look like (the dots are an effort to get formatting, I hope you get the idea)
. . . . . . . .| . . . . .Day Total . . . . . | . . . . . .Breakfaxt
. . . .Date . .|Carbs . Cal.IN . Cal.USED . Wgt |Glucose . Carbs . Insulin .Cal.IN
08/10/2012 Fri .. 88 ... 1380 .... 1980 .... 172 ... 98 . . .24 . . . .2 . . .80

My question is - where in the code do I develop and load the numbers for the day and the vairous meals?
Fri - use DateToDay() to determine the day of the week for the date

Day.Totals
- Carbs Sum.Total of carbohydrates in food eaten at all meals on the date
- Cal.IN Sum.Total of calories in food eaten at all meals on the date
- Cal.Used Calories burned from the basic-medabolic-rate calculation plus the Sum.Total of all exercise transactions entered on the date
- Wgt Avg for weigh-in transactions on the date

Breakfast
- Glucose Average of Glucose test transactions recorded relating to breakfast
- Carbs Sum.Total of Carbohydrates in food recorded relating to breakfast
- Insulin Sum.Total of Insulin recorded relating to breakfast
- Cal.IN Sum.Total of calories in food recorded relating to breakfast

Additional groups of totals for
Morning.Snack, Lunch, Afternoon.Snack, Supper, Evening.Snack, and Nite

So. where do I put the code to develop the totals so they can be included on the Looper-Line?

Thanks in advance
Membro registado
2 mensagems
Publicado em agosto, 31 2012 - 1:57 PM
One solution maybe..

Fill the looper by programming. Remove the filelink or query for content.

If i understand you right.. code below may work for you

previousdate is date
Totals1 is int = 0
Totals2 is int = 0
Totals3 is int = 0
FOR EACH TX_Dates
IF TX_Dates.date <> previousdate
//Add summed totals, or execute a query that totals for you..
LooperAddLine(MyLooper,Totals1,Totals2,Totals3)
Totals1 = 0
Totals2 = 0
Totals3 = 0
ELSE
Totals1+= TX_Dates.Field1
Totals2+= TX_Dates.Field2
Totals3+= TX_Dates.Field3
LooperAddLine(MyLooper,TX_Dates.Field1,TX_Dates.Field2,TX_Dates.Field3)
previousdate = TX_Dates.date
END
END
Membro registado
18 mensagems
Publicado em setembro, 01 2012 - 2:40 AM
Hi Robin -
Thanks for jumping in.
Yes, I think that all makes sense, the BIG QUESTION is where in the Code-Structure dos it go???? What I have is
. Loop_TxSummary 750-Wide 200-High Program loaded with no assigned content
. . Fixed width 10-Columns 75-wide 20-High

The code you show is right to get what I want. I just splin through each of the Txn.files (Food-Intake, Exercise, Weight, etc) loading the totals into a total

What Code.Embed point do I use - ???
. Initialize WIN_Summary ?
. Initialize Loop_TxSSummary ?
. Entry of Loop_TxSummary ?
. ???

I said I'm a ROOKIE :-)

Then a second question - If I go into the window editor, Looper.Control General.Tab and include the the Total.Fields as controls, can I then just use LooperAddLine(Loop_TxSummary) without listing the Total.Fields ??

Thanks again
Guy
Membro registado
18 mensagems
Publicado em setembro, 02 2012 - 5:10 AM
I've spent 4-5 hours fiddling around with this and a really DUMB questions arises.
Cant' I use a Looper over the TxDate file and as each record from the file is read go through and put the various time-segment (AM Snack, Lunch, etc..) totals into the looper?

Thanks
Guy
Membro registado
18 mensagems
Publicado em setembro, 06 2012 - 3:48 AM
BINGO! I found it!
Silly me, I thought the WinDev.mobile manuals would equip me, but not so. Read the WinDev-17 Concepts document for a rundown on Windev, THEN read WinDev.mobile Concepts for some of the differences.

I feel a lot better


Guy Bernard wrote in news message <0e14cf0906de833760649a7e9091915f@news.pcsoft>:
I've spent 4-5 hours fiddling around with this and a really DUMB questions arises.
Cant' I use a Looper over the TxDate file and as each record from the file is read go through and put the various time-segment (AM Snack, Lunch, etc..) totals into the looper?

Thanks
Guy