web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

import csv

(0) ShareShare
ReportReport
Posted on by 141

while importing csv file into table. how can i check record is already exist or not

*This post is locked for comments

  • Suggested answer
    raelhefn Profile Picture
    Microsoft Employee on at

    You can query it from sql. check if it imported or not.

    also it based on which import tool you are using custom or AX standard import tool.

    AX give you info log contains imported tables.

  • omesh Profile Picture
    141 on at

    thank you Ramy,

    This is my code for importing file

    CommaIo File;
    container File_container;
    Counter counter1,Line_counter;
    counter1 =0;
    Line_counter =0;

    File = new CommaIo("D:\\Temp\\Example.csv",'r');
    if(File)
    {


    HeaderTable.insert();

    while(File.status()==IO_Status::Ok)

    {

    try{
    File_container = File.read();
    Line_counter++;

    if(File && Line_counter>0 && (con2Str(File_container))!='')
    {
    ign_Ume_LineTable.PurchaseId= str2int(conPeek(File_container,1));
    ign_Ume_LineTable.Qty = str2int(conPeek(File_container,2));
    ign_Ume_LineTable.Price= str2int(conPeek(File_container,3));
    Ign_Ume_LineTable.ID= HeaderTable.RecId;
    ign_Ume_LineTable.insert();

    counter1++;
    info(strFmt(" - %1 - %2 -%3 -%4",conPeek(File_container,1),conPeek(File_container,2),conPeek(File_container,3),HeaderTable.RecId));

    }

    }
    catch
    {

    info(strFmt("Exception at line %1",Line_counter));

    }

    }

    info(strFmt('%1 records inserted out of %2',Counter1,Line_counter));
    }

    }

    when next time this code execute..i want to check records are exist or not into table ..?

  • Suggested answer
    raelhefn Profile Picture
    Microsoft Employee on at

    Ok, you can run

    select ign_Ume_LineTable where <YourTableId> == <Insered Field ID>

    if ( !ign_Ume_LineTable)

    {

     // Run Your code for insertion Here

    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans