NAV 2009 Web Services (Part 2b – Forms & Pages + TIF Editor)

So last time we looked at a very simple transformation process for the few forms that we have created for the little Fuel Application (look here). This time we are going to do exactly the same thing – create some pages – but we are going to see if the Transformation Input File (TIF) Editor can provide us any assistance.

Effectively the TIF editor is collection of NAV objects which are simply imported into the database and used to assist in the manipulation of the raw XML transformation files (ie. the TransformPages.xml, IgnorePages.xml, MovePages.xml, DeleteElements.xml and MoveElements.xml). As I have mentioned before, if you are comfortable with XML and its manipulation then you could simply edit these files directly, or perhaps even with another tool. We'll have a look and see what the tool from Microsoft gives us here.

The first step is to get hold of the relevant objects. As per the help files - you must copy the form transformation tool files before you can transform forms. The files that you must copy are located in the TransformationTool folder and the TransformationTool\TIF Editor folder on the installation DVD. It is the TIF.fob object file in the latter directory which we must then import into our NAV database. There you have it – all "installed"!

So what to do next...

Our starting point is one of the new forms that we have just imported as part of the TIF.fob file – Form 177000 Transformation Forms. This seems to be the central form as the other functions hang off of here. In the case that we wanted to transform a standard NAV form we would then set about the process of importing all of the xml files and then manipulating the records that we would have in this form. We of course have a few new forms which the standard application has never heard of. Our process is therefore first to tell the system about our forms. We can do this by manually entering the data, but more likely is that we will wish to use a function on the Setup button to do the job – Get Forms. This will allow us to specify a range of forms to include.

In our case, I specify the new form nos – 50000..50002 and the system inserts the 3 records for me. Well at least it inserts the Name and number! The rest I must now complete manually to tell the system how I would like to transform the various pages.

Firstly I try to lookup the FormType however I only see a blank table. To populate this table I must import a mapping file which will allow me to select the form type, and have the system automatically insert the page type. This can be done again from the Setup button – Import FT-PT mapping. Navigate to the FormToPagetypeMapping.txt file in the TIF editor folder and confirm to import.

Next assign the types to the forms and specify the cardform id against the vehicle list form:

ID

Name

Changed

FormType

PageType

CardFormID

CardFormID for

Ignore

DestinationID

DestinationName

FormReplacedBy

Comment

50000

Fuel Entries

No

List

List

 

0

No

     

Inserted 10/06/09 19:28

50001

Vehicle Card

No

Card

Card

 

50002

No

     

Inserted 10/06/09 19:28

50002

Vehicle List

No

List

List

50001

0

No

     

Inserted 10/06/09 19:28

 

This should be all that is required to generate the required xml transformation files. Export these files using the Functions button – Create All Transformation Input. Note: you will need to make sure you have specified the relevant folder in the setup form in order that the files be created in the correct place.

Whilst the 5 xml files have been created, only the TransformPages.xml file contains any data at this point.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

- <TransformPages xmlns="urn:schemas-microsoft-com:dynamics:NAV:ApplicationObjects">

- <Page ID="50000" Name="Fuel Entries">

  <Transformation FormType="List" />

- <Properties>

  <PageType>List</PageType>

  </Properties>

  </Page>

- <Page ID="50001" Name="Vehicle Card">

  <Transformation FormType="Card" />

- <Properties>

  <PageType>Card</PageType>

  </Properties>

  </Page>

- <Page ID="50002" Name="Vehicle List">

  <Transformation FormType="List" />

- <Properties>

  <PageType>List</PageType>

  <CardFormID>50001</CardFormID>

  </Properties>

  </Page>

  </TransformPages>

 

This is because we have not added or changed any of the form properties etc in the TIF Editor.

At this point we should now be in a position to take the Forms.xml file from my last blog (ie. the xml export of the 3 forms from NAV) and run it through the transformation tool (again as we did before).

Interesting to note at this point that you may get an error similar to the following in your transformation log:

Error: Schema: \IgnorePage.xsd

Error: Form -2: The validation for file:///C:/Program Files/Microsoft Dynamics NAV/60/TransformationTool/IgnorePage.xsd.tmp.xml failed. Detailed Information: LineNumber=2, LinePosition=2

Error: Form -2: The element 'IgnorePages' in namespace 'urn:schemas-microsoft-com:dynamics:NAV:ApplicationObjects' has incomplete content. List of possible elements expected: 'Page' in namespace 'urn:schemas-microsoft-com:dynamics:NAV:ApplicationObjects'. Error: Some input file can't be validated by schema. Please, correct it and rerun tool again

 

This is basically because the files that we created do not contain data and the schema files used to validate them are expecting them. See the following: http://www.mibuso.com/forum/viewtopic.php?f=32&t=31187&start=0

I'm not yet aware of a fix for this so I edited the XSD files as the post mentions. Note however that I also needed to amend the MovePageElements.xsd file.

So finally we can import our new Pages.xml file and check our results.

 

So whilst we have basically followed the same process, we get slightly different results. The benefit of using the TIF editor to arrive at these new pages is that we can very easily add additional components and change attributes without directly manipulating the resultant pages. This means that the process is then repeatable.

So whichever method we choose, we now have the required pages for our application. We could go about adding these to an existing page or role center or creating a new one, however as we are more concerned with consuming these pages via an external application we will leave that to a more capable person.

Comment List
Related
Recommended