I'm learning Ext.

I'm about to finish my first project with Ext. It's a complete rewrite of an Active4D site I did a few years ago. I can only say that programming with Ext is more like programming with Java/Swing than web programming. The toolkit is huge and amazing.

I wrote some utility stuff for use with Ext which I will hopefully get around to posting soon, once I finish the project.


As a sample project I'm reworking a status page that is currently generated by Active4D. In less than a day I've developed something that is really nice and am now tweaking it.

I've defined a map like this.

$map := new collection("id" ; - >[Mail_Queued_Messages]ID; \\ "status" ; - >[Mail_Queued_Messages]Message_Sent; \\ "error" ; - >[Mail_Queued_Messages]Message_ErrorCode; \\ "queued_on" ; - >[Mail_Queued_Messages]Message_QueuedDTS; \\ "last_sent_on" ; - >[Mail_Queued_Messages]Message_LastSentDTS; \\ "subject" ; - >[Mail_Queued_Messages]Message_Subject )

Note the Message_ErrorCode field. That stores an longint error value returned from 4DIC, if one is returned upon SMTP_Send. In my old pages I display 4DIC's error string for that numeric error code. I'd like to do the same here.

Is there a straightforward way that I can pass a function to new collection the when I create my $map, so that the "error" would contain the error string instead of the numeric code?

As it turns out, I needed the same kind of thing, so of course I added that ability. With RowSets we have column expressions, you can do a similar thing when setting up the map for addSelection(). Instead of of giving a field pointer, just specify the text you want to execute, which should evaluate to a value.

So in your example above, the map would become:

$map := new collection("id" ; - >[Mail_Queued_Messages]ID; \\ "status" ; - >[Mail_Queued_Messages]Message_Sent; \\ "error" ; "getErrorMsg([Mail_Queued_Messages]Message_ErrorCode)"; \\ "queued_on" ; - >[Mail_Queued_Messages]Message_QueuedDTS; \\ "last_sent_on" ; - >[Mail_Queued_Messages]Message_LastSentDTS; \\ "subject" ; - >[Mail_Queued_Messages]Message_Subject )

If you need to execute an expression within 4D (because it uses commands not supported by Active4D), prefix the expression with "!".

Regards,

   Aparajita
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoy.org


_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to