/ Forums / Advansys Formativ / Creating Solutions with Formativ / Learning Formativ and using Forms and Fields

  • Creator
    Topic
  • #4132
    embru
    Participant

    Hi Advansys Support

    I’m a “Newbee” in Formativ-Programming, i have many years experience in procedural-Programming, but only a view
    experience in oo-Languages.

    For a specific Project, i have to create a form (ie with Form Designer). The fields on this form don’t exists
    on a GW Message – so maybe i have to create a new message type (corresponding of the Task Message). The Form must be
    sent to another user in our network and must be visible as the same form the Sender creates, like your example “TUT333
    Support Request”. After the Receiver (Supporter) of the forms accept’s his task, a new form with a checklist must be sent
    to the supporter with a Checklist to do his task.

    The Applet-Logic will be similar to the TUT333-Example, but i have to save/read additional values. The example works
    with two standard fields Subject and the message body. In my Projekt i have to work with about 20 own fields. I analyzed
    the example “Leave Request Workflow”, but it was to complicate for me. Ie. how can I store additional fields in GW when i
    work with designed forms and not generating coded forms and how can i restore them.

    What’s the best approach to realize that und to learn formativ-Programming. The Help-Files and the Tutorial are not helpfull
    enough for me – i need Information for a “Newbee”.

  • Author
    Replies
  • #7218
    Support 1a
    Participant

    Thank you for your posting. You have two general options when you need to store many custom field values. Both involve the creation of a custom message type as you state.

    The first approach is to create custom fields in the message, and store the values in the fields. This is purely a native GroupWise Object API technique, and is beyond the scope of what I can describe here. Nonetheless, have a look at: http://developer.novell.com/ndk/doc/gwobjapi/gwobjenu/data/hrgfssmm.html, specifically the Fields property of the message object. In a nutshell, you need to create a field definition associated with an account if it doesn’t exist, then create one or more fields associated with the message via the Fields property. Your applet reads and writes values to these fields.

    The second approach, and probably the one I would recommend, is to use XML to store the field values, then store the XML in the body text of the custom message. This has the advantage of not having to define potentially large numbers of field in your GroupWise system, and is more easily extensible. When the message is opened by the recipient, your applet parses the XML contained in the body of the message and populates the custom form. You can find an example of creating a message containing XML data in the example applet called ‘TUT333 – MIIRalert.vbf’.

    I hope this information is sufficient to get you started. Feel free to post any specific questions you may have.

    Regards,

    Advansys Support

    #7221
    embru
    Participant

    Thanks for the tipp. I’m generating a xml-String in the message body with the “TUT333 – MIIR Alert”. That works fine. But how can i read the xml-elements in the message body? Have you a code sample?

    Thanks

    #7220
    embru
    Participant

    Hi

    I generate the xml-String like this:

    set iDOM = Utilities.XMLDom
    set iDoc = iDOM.Document

    set iNode = iDoc.createProcessingInstruction(“xml”, “version=’1.0′”)
    iDoc.appendChild(iNode)
    set iNode = nothing

    set iRoot = iDOM.Document.createElement(“NewUserFormular”)
    set iAttr = iDoc.createAttribute(“id”)
    iAttr.value = “Neu”
    iRoot.setAttributeNode(iAttr)
    set iAttr = nothing

    iDoc.appendChild(iRoot)

    set iFieldsNode = iDoc.createElement(“data”)
    iRoot.appendChild(iFieldsNode)

    set iNode = iDoc.createElement(“nachname”)
    iNode.text = NewUser.NUNachname.Text
    iFieldsNode.appendChild(iNode)
    set iNode = nothing

    My Problem is, that i don’t know, how to load the xml-String in my Variables to use the method GetElementsByTagName.

    my code is currently not working:

    set iDom = Utilities.XMLDom
    set iDoc = iDom.Document
    iDoc.Async = “false”
    iDoc.LoadXML(iMsg.BodyText.PlainText)
    msgbox(iMsg.BodyText.PlainText)

    ‘iDoc.XML = iMsg.BodyText.PlainText
    Set iRoot = iDoc.documentElement

    NewUser.NUNachname=iRoot.getElementsbyTagName(“Nachname”).item(0).text
    NewUser.NUVorname = iRoot.getElementsByTagName(“Vorname”).item(1).text

    thanks

    #7219
    Support 1a
    Participant

    We don’t have a specific example, but you would use the XML DOM to access the elements in the XML. Formativ exposes the native Microsoft XML DOM, which means you can access all the members of the IXMLDOMDocument2 interface. See the following URL for more details:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/2dfe145d-c9a5-47d9-8ae3-7722befedd90.asp

    In a nutshell, you would call Utilities.XMLDom in your applet to create an instance of the XML DOM wrapper. You would then load the XML from the body string of the message with a call like this:

    set oDOM = Utilities.XMLDom

    oDOM.LoadFromString(iMsg.BodyText.PlainText)

    You would then be able to access the XML via the standard XML DOM interface. You should be able to find examples of this on the microsoft Web site mentioned above. You can also use XPath to locate specific nodes. Again, this is documented at the site mentioned above.

    Regards,

    Advansys Support

    #7223
    embru
    Participant

    Thank’s for your help. My code is growing

    #7222
    Support 1a
    Participant

    Great news. Feel free to post any questions you have.

    Advansys Support

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.