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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

HELP! Validate Conpeek

(0) ShareShare
ReportReport
Posted on by

(GoogleTraductor)

Hello greetings. Colleagues tell them my problem. I have an income of a CSV I read it with a conpeek which I have to accept or grasp it before it enters the data to my table. What happens is that whenever an unsupported data recording and Date, Real, or Enum, in showing me see any error only entered as empty fields ..As catch that error ?? or some way to tell my board does not accept null data. I tried to TypeOf or a settlement. I need to give equal TransDate EDT as a stop to equal it and enter and capture the error, this logic believe that official or a way that the table is not empty data are accepted and be shown on screen. Greetings hopefully can help me.

Español

Hola Saludos. Colegas les cuento mi problema. Tengo un ingreso de un CSV que lo leo con un conpeek al cual lo tengo que validar o captar antes de que ingrese los datos a mi tabla. Lo que pasa es que cada vez que registrar un dato no compatible como en Date, Real, o Enum, en ves de mostrarme algún error solo los ingresa como campos vacíos .Como captar ese error?? o alguna manera de decirle a mi tabla que no acepte datos nulos. Lo intente con TypeOf o con un arreglo. necesito hacerle una igualdad a transdate con un EDT como parar que lo iguale e ingrese y capte el error, esa lógica creo que funcionaria o una manera de que en la tabla no se acepten datos vacíos y poder mostrarlos en pantalla. Saludos ojala me puedan ayudar.

This is my code that just enter but does not capture the error:

readCon = csvFile.read();
while (csvFile.status() == IO_Status::OK)
{
readCon = csvFile.read();


  if (conPeek(readCon, 4))
  {
   try{
       if (typeOf(str2Date(conpeek(readCon, 4),123)) == Types::Date){
           transdate_ = conPeek(readCon, 4); 
       }else{
       throw Global::error("Error en TransDate.");
       }
   }catch{
    info("error al cargar");
   }//try
  }//if

Mitabla.CampoDate       = str2Date(transdate_,123);

}//while

*This post is locked for comments

I have the same question (0)
  • Dauvis Profile Picture
    170 on at
    RE: HELP! Validate Conpeek

    The str2Date method will return a date for any string you pass to it.  If the string is not in a valid format or is blank, it will return a null date.  You can try the following...

    dateString = conpeek(readCon, 4);

    if (str2Date(dateString) == datenull())

    {

       throw error('Error en TransDate');

    }

  • Community Member Profile Picture
    on at
    RE: HELP! Validate Conpeek

    nop :/ I take everything as an error, the error does not capture only vacuum. try to do otherwise but I get one error 1 per day and do not enter any date

                      try{    

                           // If it's a date that should be a utcDateTime, upgrade it

                           if (typeOf(conpeek(readCon, 4)) == Types::Date      &&

                               dictField.baseType()    == Types::UtcDateTime)

                           {

                               readCon = conPoke(readCon, 4, DateTimeUtil::newDateTime(conPeek(readCon, 4), 0));

                               transdate_ = conPeek(readCon, 4);

                           }else{

                               info("error  1");

                            }

                            }catch{

                                   Info("Error Transdate");

                           }

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
AlissonGodoy Profile Picture

AlissonGodoy 2

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans