Is there a straightforward way that I can pass a function to new collection 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 "!".

Awesome!

Do I understand correctly that I need to use RowSets for this to work? I tried to change my simple example which uses a regular 4D selection and Active4D is throwing an error about "expecting a pointer".

The Mail_ErrorText method is a 4D method. It calls a plugin method and is accessed by 4D Client code too. So I need to call it like this?

"error" ; "!Mail_ErrorText([Mail_Queued_Messages]Message_ErrorCode)"; \\

Thanks,

Brad



_______________________________________________
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