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

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Suggested answer
    raelhefn Profile Picture
    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
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans