4D Internet Commands v16Appendix A, Programming Tips |
||
|
4D Internet Commands v16
Appendix A, Programming Tips
Appendix A, Programming Tips
In many of the examples in this document, a programming construct is used which is likely to be unfamiliar to many developers. Many of these examples execute a series of commands as falsified cases within a 4D Case statement. Many of the commands within 4D Internet Commands require that an entire sequence of commands execute successfully in order to complete. Since the failure of any one command within the sequence should stop any further processing along that path, it would become laborious to cascade your If conditions many level deeps: If(SMTP_New($smtp_id)=0) An alternative to this method is to rely on the manner in which 4D executes it's case statements. Each item of a case statement is executed by 4D in order to determine if its return value is True or False. If all elements of a case statement were to return a false value, then each element of that case statement's tests would have been run. We can execute the same code described above by the following: $SentOK:=False `A flag to indicate if we made it through all of the calls In the above example, every 4D Internet command will return a zero error number if it successfully completed. In order for 4D to evaluate each case statement, it must actually execute each external call to obtain its return value. Since each case element compares the return result to not zero, 4D will not find an element to stop on until one of the commands fails. If every command executes successfully, 4D will proceed down to run the Else condition where we set the $SentOK flag to indicate that the message was composed and sent successfully. If you are planning on implementing a mail system within your database in which the user can "Reply" to mail they have received, there are some standard suggestions for how to fill out the fields of the reply message. The following suggestions are outlined by RFC#822:
These suggestions are only meant to help the decision process when the mail addressing is programmatically handled in the case of "Reply" type actions. Once the Reply message has been created, the end-user can certainly override any of these defaults before sending the message.
|
EIGENSCHAFTEN
Produkt: 4D Internet Commands
GESCHICHTE
ARTIKELVERWENDUNG
4D Internet Commands ( 4D Internet Commands v16) |