General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Load Access Forms in XMetaL?

  • spyro

    Load Access Forms in XMetaL?

    Participants 6
    Replies 7
    Last Activity 13 years, 5 months ago

    Hello everbody,

    I have some very complex Access-Forms I would like to use in XMetaL.
    The resulting recordset/strings should be used as attribute-values inside the active document's content.

    What's the best way to achive this?

    Thanks for helping me! 🙂
    spyro

    Reply

    Derek Read

    Reply to: Load Access Forms in XMetaL?

    I'm not sure exactly what you need (more details would help), but there is a sample macro included with the Journalist demo that imports data from an Excel file. It might be useful to look at. It uses ODBC so the same could be done for other data sources.

    Assuming you have XMetaL Author Essential or Enterprise 5.5:

    1) Help > Samples > Journalist Sample Files.
    2) The file CamerasInFocus.xml should open.
    3) Open the Macros toolbar and run the macro called “Import Table” or open the “Journalist 2” toolbar and click the button “Import Database Table”. A dialog will appear and the default settings should all be set properly to import data from a sample Excel file.
    5) Click “OK” to use these default settings. The data will be inserted into a table in the CamerasInFocus.xml document.

    There are lots of things that occur to make this work. The macro “Import Table” is included in the journalist.mcr file located in the Macros folder of your XMetaL Author installation. Many of the things it does could be done differently to give similar or very different results and you have complete control over what ultimately gets inserted, though you have less control over the format of what gets written to disk (a temp file), which you can play with on the “Output Format” tab. That means that if what ends up being written to disk is wildly different from what you need to insert you will need to do some parsing before insertion (or perhaps some additional massaging of the document after or during insertion).

    The Programmer's Guide topic relevant to this discussion is called “The Import Database dialog box”.

    An alternative idea would be to use something like Microsoft's ADODB instead (we have no example of this).

    Reply

    spyro

    Reply to: Load Access Forms in XMetaL?

    Hello Derek Read,

    thanks for your quick answer!

    XMetaL surely is great for importing, converting and handling nearly all kind of data and using it for the creation and manipulation of XML. But I need not only to access or import the data in my DB but to show the already bulit MS-Access Form in XMetaL to get the data I need (SQL-String or ready-to-use recordset).

    Is this possible with XMetaL?

    Thanks again,
    spyro

    Reply

    ghkrause

    Reply to: Load Access Forms in XMetaL?

    Could you give a screenshot of the dialog and describe what is fix and what is to be selected or entered by the user? A static SQL statement is simple to query a database and display the values in a dialog. But your words may indicate that the user has to enter that SQL statement on the fly? Or select one out of a given choice?
    Maybe you could elaborate on your use case? Eg. you have 10 valid attribute values that should be selectable in a dialog.
    (Attribute values could be defined in schema or DTD, however, in some cases the flexibility is needed to define them in a database.)
    Please let us understand what the benefit of reuse of a MS Access Form is over developing an XMetaL dialog.

    Reply

    spyro

    Reply to: Load Access Forms in XMetaL?

    Sure:

    I have 30-50 forms like this:

    [img]http://img524.imageshack.us/img524/4952/accessform.png[/img]

    With VBA I could read out the underlying SQL-String which is generated by the form to each query of the user and then read out the data with XMetaL's internal database-tools. (Maybe it's possible to get the already processed recordset directly from access.)

    Otherwise I've to rebuilt all this predesigned Access forms with the XMetaL Layout Tool.

    spyro

    Reply

    Derek Read

    Reply to: Load Access Forms in XMetaL?

    Here is an article from the turn of the century that might be of some use:
    [url=http://www.google.ca/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Faa140069(office.10).aspx&ei=ARbpSc-FCYSKtAPjvtXmAQ&usg=AFQjCNGIMF9_aeFkoVlqFZkbHP619EYV8Q&sig2=pHzPGFXWNZarMXX2BLnpxA]MSDN Library (2000) 'Effortlessly Convert Access Forms to VB Objects'[/url]

    If I read that correctly, you could convert your forms (using some 3rd party tool) and they can be called from (or used in) VB. In theory this means you might be able to create a VB application that reuses them and (again in theory) this VB application might instantiate XMetaL Author using COM and (assuming the VB app can extract information from your form) pass it to XMetaL Author. Such a VB app, at the very simplest, might look like this (code for a form containing a button called “Button1”):

    [code]Public Class Form1
        Dim xma
        Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
            'Destroy XMetaL COM object when form closes
            xma = Nothing
        End Sub
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Instantiate XMetaL as COM object at form open
            xma = CreateObject(“XmetaL.Application”)
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim dataVal
            '…the code that somehow interacts with your converted Access form here…
            dataVal = “test” 'note: hardcoded for testing

            'Put the data into XMetaL (extremely simplistic example):
            xma.Selection.MoveToDocumentStart()
            xma.Selection.MoveToElement(“Para”)
            xma.Selection.ContainerAttribute(“Id”) = dataVal
        End Sub
    End Class[/code]

    I have not tested this, and unfortunately I do not have time to do so (though it seems interesting).

    If you can find a tool that will convert these Access forms to compatible ActiveX objects you might be able to embed them directly into an XFT form. However, I have no idea if such a tool exists (perhaps one of the ones listed at the link above does this, or you can find one given the right search phrasing).

    Reply

    spyro

    Reply to: Load Access Forms in XMetaL?

    Thank you, I will test this! 🙂

    Reply

    Derek Read

    Reply to: Load Access Forms in XMetaL?

    If you find out anything useful please share with the forum. Might save others some time.

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support