XMLport (Import), how to set default path?

boywonderboywonder Member Posts: 179
I have written an XMLport (Import) and I want to store a default path somewhere and then when the XMLport runs it automatically shows this folder / file location and only CSV files. No problem for me in dataports but unsure if this is possible in XMLports?

I have preset the FileName property on the XMLport main properties page with *.csv and this works so that bit at least is solved!

But how can I do the file location bit... :? :?

Comments

  • boywonderboywonder Member Posts: 179
    Does anyone have an idea on this?

    I've tried copying the dataport request form 'Filename' box I created onto the XLMport request page but it won't appear (running through RTC..)? I just get the error message I input to stop if filename = blank :(
  • boywonderboywonder Member Posts: 179
    right I've moved this on a bit now...

    I've got the usual stuff from a dataport working, ie. I placed a field on the Request Page with sourceexpr of "Filename" (defined as a C/AL global text250) and in the OnLookup trigger call codeunit 412 for the file functionality, passing in path/filename.

    This is working, but immediately afterwards another box appears asking for the filename again, this is the standard XMLport import box...

    So how do I stop that one popping up?

    If I try RequestForm = No then mine stops appearing :shock:
  • fufikkfufikk Member Posts: 104
    Hi,

    did you manage to solve the problem with pop-up for filename? I'm in the same spot right now and trying to figure out how to aviod the extra pop-up.

    thanks,
  • ShedexShedex Member Posts: 20
    Hello,

    nobody has an answer to this ?

    I am currently in the same situation but impossible to change this path and to dismiss this window. I want everything to be done in automatic.

    Thank you for your help^^
  • MarkHamblinMarkHamblin Member Posts: 118
    I'm not sure there is any way to prevent the NAV file selection box from popping up, and the closest we've gotten to defaulting the path is to show it in the "file name" edit in the file selection dialog (see the Universal XMLport - http://mibuso.com/dlinfo.asp?FileID=1474). By setting the XMLport filename to the path (and extension if you like), the default file selection dialog shows these, but does not actually select the path until the user hits "Open". It sounds like you've already made it that far - I'm guessing that's as far as you'll be able to take it.

    A better option for you might be to launch the XMLport from a report (or page) instead. That way you can do all the file selections, etc., from the report's request page, and run the XMLport without the request page shown at all - that should solve the problem.

    - Mark
  • ShedexShedex Member Posts: 20
    Hello Mark

    Thank you for your response.
    I'll keep your side project is very interresting.

    I would like to try this option :

    "A better option for you might be to launch the XMLport from a report (or page) instead. That way you can do all the file selections, etc., from the report's request page, and run the XMLport without the request page shown at all - that should solve the problem."

    But what it is the correct syntax to start the XMLPORT from a button from a page or start from a code unit (I am in NAV 2009 R2)?

    I tried this:

    Gfile_MonFichier.CREATE('C:\xx\xxx\xxxx\xx\xxx\xxx.csv');
    Gfile_MonFichier.CREATEOUTSTREAM(XmlStream);
    XMLPORT.EXPORT(60004, XmlStream);
    Gfile_MonFichier.CLOSE;

    The result is:

    <?xml version="1.0" encoding="UTF-16" standalone="no"?>
    <ProductionOrderFile>
    <ProductionOrderOF>
    <Status>SimulÚ</Status>
    <No>OFS000001</No>
    <Description>Conteneur non Pyro C42</Description>
    <SearchDescription>CONTENEUR NON PYRO C42</SearchDescription>
    <Description2/>
    <CreationDate>18/09/12</CreationDate>
    <LastDateModified>18/09/12</LastDateModified>
    <SourceType>Article</SourceType>
    <SourceNo>K 0045 H-A</SourceNo>
    <RoutingNo>ATV</RoutingNo>
    <InventoryPostingGroup>SEMI FINI</InventoryPostingGroup>
    <GenProdPostingGroup>SEMI FINI</GenProdPostingGroup>
    <GenBusPostingGroup/>
    <Comment>Non</Comment>
    <StartingTime>11:14:59</StartingTime>
    <StartingDate>01/10/12</StartingDate>
    <EndingTime>16:45:00</EndingTime>
    <EndingDate>01/10/12</EndingDate>
    <DueDate>02/10/12</DueDate>
    <FinishedDate/>
    <Blocked>Non</Blocked>
    <ShortcutDimension1Code/>
    <ShortcutDimension2Code/>
    <LocationCode/>
    <BinCode/>
    <ReplanRefNo>OFS000001</ReplanRefNo>
    <ReplanRefStatus>SimulÚ</ReplanRefStatus>
    <Low-LevelCode>0</Low-LevelCode>
    <Quantity>60</Quantity>
    <UnitCost>0,00</UnitCost>
    <CostAmount>0,00</CostAmount>
    <WorkCenterFilter/>
    <CapacityTypeFilter>Centre de charge</CapacityTypeFilter>
    <CapacityNoFilter/>
    <DateFilter/>
    <ExpectedOperationCostAmt>0</ExpectedOperationCostAmt>
    <ExpectedComponentCostAmt>0</ExpectedComponentCostAmt>
    <ActualTimeUsed>0</ActualTimeUsed>
    <AllocatedCapacityNeed>0</AllocatedCapacityNeed>
    <ExpectedCapacityNeed>0</ExpectedCapacityNeed>
    <NoSeries>P-DEV</NoSeries>
    <PlannedOrderNo/>
    <FirmPlannedOrderNo/>
    <SimulatedOrderNo/>
    <ExpectedMaterialOvhdCost>0,00</ExpectedMaterialOvhdCost>
    <ExpectedCapacityOvhdCost>0</ExpectedCapacityOvhdCost>
    <StartingDate-Time>01/10/12 11:14</StartingDate-Time>
    <EndingDate-Time>01/10/12 16:45</EndingDate-Time>
    <CompletelyPicked>Non</CompletelyPicked>
    <AssignedUserID>VERONGOU</AssignedUserID>
    </ProductionOrderOF>
    </ProductionOrderFile>

    But I would like this, a simple csv file:

    Simulé;OFS000001;Conteneur non Pyro C42;CONTENEUR NON PYRO C42;;18/09/12;18/09/12;Article;K 0045 H-A;ATV;SEMI FINI;SEMI FINI;;Non;11:14:59;01/10/12;16:45:00;01/10/12;02/10/12;;Non;;;;;OFS000001;Simulé;0;60;0;0;;Centre de charge;;;0;0;0;0;0;P-DEV;;;;0;0;01/10/12 11:14;01/10/12 16:45;Non;VERONGOU

    If I start the xmlport with a simple menu in nav, the browse windows appear, I select my folder blabla and the result is correct, I have a good csv file but I do not want this browse window appears :(

    Thank in advance
  • MarkHamblinMarkHamblin Member Posts: 118
    I've never tried generating CSV from an XMLport when calling it from code - I would have expected it to work the same as running the XMLport interactively.

    There may be a solution using the XMLport, but I wonder if that's really the best approach for you in this case. By the time you're done, you're actually using almost none of the functionality that you would want an XMLport for (file selection, XML output, etc.). You might be better off just writing some code in a report to generate the CSV file.
  • ShedexShedex Member Posts: 20
    Hello Mark,

    I found the problem.

    I deployed my development in a version in NAV2013 and it works as I would. I obtained a good csv delimited by ";"

    I tested this method from a codeunit:

    Gfile_MonFichier.CREATE('C:\xx\xxx\xxxx\xx\xxx\xxx.csv');
    Gfile_MonFichier.CREATEOUTSTREAM(XmlStream);
    XMLPORT.EXPORT(60004, XmlStream);
    Gfile_MonFichier.CLOSE;

    So there is a problem for XMLPORT in NAV 2009 R2( v6.00.3212) when it is a type is "variable text".

    There is there a fix to apply ?

    Thank in advance.
  • MarkHamblinMarkHamblin Member Posts: 118
    Shedex wrote:
    I found the problem.

    I deployed my development in a version in NAV2013 and it works as I would. I obtained a good csv delimited by ";"

    I tested this method from a codeunit:

    Gfile_MonFichier.CREATE('C:\xx\xxx\xxxx\xx\xxx\xxx.csv');
    Gfile_MonFichier.CREATEOUTSTREAM(XmlStream);
    XMLPORT.EXPORT(60004, XmlStream);
    Gfile_MonFichier.CLOSE;

    So there is a problem for XMLPORT in NAV 2009 R2( v6.00.3212) when it is a type is "variable text".

    There is there a fix to apply ?
    Good to know what the problem is - I don't remember seeing any fix for that, but then again, I haven't really been looking for one. If you have to support 2009, using something other than the XMLport might be the way to go.
Sign In or Register to comment.