How to import all of the RTC Charts?

Dave_CintronDave_Cintron Member Posts: 189
edited 2013-10-23 in NAV Three Tier
Does anyone know how to do this? They do not automatically populate when creating a new database. I can't believe I would have to do them one at a time...
Dave Cintron
Dynamics West
http://www.dynamicswest.com

Comments

  • matttraxmatttrax Member Posts: 2,309
    I can't remember if I just wrote a dataport. I know I didn't type them in manually, but also know that they weren't generated by the system, so it must have been how I did it.
  • Dave_CintronDave_Cintron Member Posts: 189
    A dataport cannot be used because these are in XML format. When I write an XMLport, I only get one chart. Does anyone know how to export all of the charts into a single file, or to otherwise copy them to a new database? NO GUESSES PLEASE.
    Dave Cintron
    Dynamics West
    http://www.dynamicswest.com
  • henrikmhenrikm Member, Microsoft Employee Posts: 66
    There is no build in support for exporting all the objects at once.

    It is though possible to access the data:
    The chart data is stored in table 2000000078 (Chart). The blob field contains the XML.

    However there is some C/AL code being called in codeunit (3-Tier Automation Mgt.) in order to both import and export the xml:
    "3TierMngt".BLOBExport(BLOBRef,'*.XML',TRUE)
    "3TierMngt".BLOBImport(BLOBRef,'*.xml',TRUE)

    If you take a look at the import/export actions of page 9182 (Charts) you should be able to find the pieces used to import and export a single Chart definition (xml).

    Hope that gets you going.
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Henrik Metzger, Software Development Engineer, Dynamics NAV
    MSFT
  • Dave_CintronDave_Cintron Member Posts: 189
    I did use the export code to create an XML port that would export all of the charts at once. The problem now is the BLOB. In the BLOB section the <brackets> are exported as escape characters. I tried the code below but get the "This Automation variable has not been instantiated." error on XMLNode as noted by others in this forum. If I CREATE XMLNode I also get an error.

    IF ISCLEAR(XMLDom) THEN
    CREATE(XMLDom);

    Chart.CALCFIELDS(BLOB);
    IF Chart.BLOB.HASVALUE THEN BEGIN
    Chart.BLOB.CREATEINSTREAM(BlobInStream);
    BLOBxml.READ(BlobInStream);

    XMLElement := XMLDom.documentElement;
    XMLNode := XMLElement.selectSingleNode('BLOBxml');

    CLEAR(BLOBxml);
    XMLText := XMLNode.text;
    BLOBxml.ADDTEXT(XMLText);
    END;
    Dave Cintron
    Dynamics West
    http://www.dynamicswest.com
  • henrikmhenrikm Member, Microsoft Employee Posts: 66
    I have been OOF. I will get back to you asap. Sorry for the delay.
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Henrik Metzger, Software Development Engineer, Dynamics NAV
    MSFT
  • henrikmhenrikm Member, Microsoft Employee Posts: 66
    Just realized that you might want to prefer using and XMLPort however I created a small test using actions on the page. The output from that was:

    Exporting the charts from RTC can be done by adding an Export All action to the functions on the Charts (9182) page:
    IF ChartTable.FIND('-') THEN
    REPEAT
      ChartTable.CALCFIELDS(ChartTable.BLOB);
      IF ChartTable.BLOB.HASVALUE THEN BEGIN
        BLOBRef.Blob := ChartTable.BLOB;
       "3TierMngt".BLOBExport(BLOBRef, ChartTable.ID + '.XML', FALSE);
      END;
    UNTIL ChartTable.NEXT <= 0;
    MESSAGE('Done exporting!');
    

    Please notice:
    1) "3TierMngt".BLOBExport returns the output path for a given chart (TEMP folder).
    E.g.: C:\Users\{UserName}\AppData\Local\Temp\1\Microsoft Dynamics NAV\40844

    2) By specifying FALSE to the output the file is named automatically (can be confusing)!

    In order to import the Chart data I did this:
    // TODO: Loop all xml documents in the XML folder
    IF "3TierMngt".BLOBImport(tempBlob,'{TEMP}\chart_(1).xml', FALSE) = '' THEN
      EXIT;
    
    // TODO: Find a unique ID for the Charts (based on the table id in the ChartDefinition).
    // TODO: Get the name from the ChartDefinition.
    ChartTable.INIT;
    ChartTable.ID := '1';
    ChartTable.Name := 'Chart Import 1';
    ChartTable.BLOB := tempBlob.Blob;
    IF ChartTable.BLOB.HASVALUE THEN
      ChartTable.INSERT(TRUE);
    CurrPage.UPDATE(FALSE);
    MESSAGE('Done importing!');
    

    Let me know if you need the XMLPort way of dealing with importing the charts.

    Note: I do not often look at C/AL.
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Henrik Metzger, Software Development Engineer, Dynamics NAV
    MSFT
  • aseigleaseigle Member Posts: 207
    henrikm wrote:
    Let me know if you need the XMLPort way of dealing with importing the charts.

    I would be very interested if you have an easy way for importing and exporting charts all at once. I did modify the Chart Page to export all charts, but wish that they would keep their Code and Description in the name of the file, which would make importing alot easier as well.

    thanks for your consideration.
  • aseigleaseigle Member Posts: 207
    aseigle wrote:
    I did modify the Chart Page to export all charts, but wish that they would keep their Code and Description in the name of the file, which would make importing alot easier as well.

    After re-reading your comment, I realized that by changing the FALSE Value to TRUE, I could preserve my Chart ID.

    Is there any way to modify the import to read the name instead of using

    ChartTable.ID := '1';
    ChartTable.Name := 'Chart Import 1';

    Thank you.
  • MariaMaria Member Posts: 3
    how can we change the color of the charts in RTC?
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Maria wrote:
    how can we change the color of the charts in RTC?
    Do you mean the colour of the bars ?

    If Yes,
    Go to properties of chart and Data tab-->Edit the values
    Go to Appearance tab--> Click Series Style..Go to Fill Tab and Change the Colour..
  • jreynoldsjreynolds Member Posts: 175
    You can use XMLPorts to export/import the BLOBs as follows.

    Export – Create an element with SourceType – Text, TextType – BigText, and the VariableName is the name of a BigText variable. In the OnBeforePassVariable trigger, stream the BLOB into the BigText variable and then add '<![CDATA[ ' to the beginning of the variable and ' ]]>' to the end.

    Import – Same thing with the SourceType, TextType, and VariableName. In the OnAfterAssignVariable trigger strip off the '<![CDATA[ ' and ' ]]>' before streaming the BigText variable out to the BLOB.
  • minty_friendminty_friend Member Posts: 38
    Hi Guys,

    I am facing some other problem, i have a database which is recently upgraded from Nav 5 to Nav 6 R2, all the charts has been deleted during the migration process, and now when i tried to import the charts from the base, import function is not working on form 9182 i.e charts....

    When i click on import button it directs me to the object designer...
    Is someone aware of this issue..???

    PLZ help
  • vremeni4vremeni4 Member Posts: 323
    Export using SQL command BCP in command window:

    bcp "[Demo Database NAV (7-0) FPack].dbo.Chart" out "C:\Temp\chart_table.bak" -T -c

    Import in a new database:

    bcp "[NAV-LIVE].dbo.Chart" in "C:\Temp\chart_table.bak" -T -c
Sign In or Register to comment.