Skip to Navigation | Skip to Content

Forums

Datetime datatype and loops

Feb 8 2007 at 1:08 am

ssvp

I think at least the table does not support datetime format, which is a major pain if you want to look at timestamps on the fly. Writing to excel writer does get the datetime in, but that requires additional steps.

Also how do we loop through rows of data from excel file/table. Do you have support for: if-then-else or for loops in one of the modules, or do we need to do VB scripting?

Please advise.

Feb 8 2007 at 10:16 am

byron

Hi - you're right about the datetimes, and it is a pain. I'll post a component to show you how to work around that.

The looping in Proto is handled in two ways:
1. If you can express what you want to do with a formula (like you would build and then copy-paste next to a table in Excel), read about the Entryset Formula (http://www.protosw.com/docs/tutorials#calculation)

2. If you want to do anything beyond that, you can use the Attribute Calculator, which should probably be called an "iterator" but grew up with a different intention, to loop through an Entryset sending a range of data to a Custom Module at each step. Here's a tutorial covering that: http://www.protosw.com/docs/tutorials/custom-module-...

If you describe what you're trying to do, I can point you to the right material or post an example component showing the steps.
cheers,
Byron

Feb 8 2007 at 11:32 am

esan

Hi, theres now a component on the gallery that uses VBA to allow you to convert dates to strings of dates and times, dates, or just times.

Here’s how it works:

The start button sends a blank input entryset to the Entryset Formula which outputs the current date and time into each cell.

The result is shown in the “DateTime Now” table. Of course, times aren’t shown in this version of Proto. So using VBA inside the Attribute Calculator we convert each date in the input entryset into a string, then output the whole string and each part to the new attributes of the table.

https://www.protosw.com/mods/lib/view/360

Hope this helps

Attached File

Feb 8 2007 at 10:07 pm

ssvp

Byron/esan/jeb,

Combined message for this post and http://www.protosw.com/forums/general/51

Thanks for the inputs. What i am really trying to do? -- Get the iPod. Ha. Anyway getting back to work.

I want to enable EditGrid users to backup all their spreadsheets onto their desktop using Proto. EditGrid already has an app that does that, but doesn't work if your are behind a proxy-server. So Proto can easily take care of this part and add much more value, which you very well know. Using EditGrid API you can get your "booklist"(primarykey: bookID), that has last modified timestamp and more for each of the spreadsheets. I basically want to loop through the bookIDs and bookNames, check if the spreadsheet is already present and needs updates, or create a new if not present.

I have more ideas in mind besides this, but each of them needs "for" loop somewhere in the code, which should be something like they way we do in php.

I will go through all your suggested methods above and let you know how it works out.

 
Already using Proto? Log In | Register