|
problème avec HImporteTexte |
Iniciado por le mulet, 18,jun. 2017 01:10 - 8 respuestas |
| |
| | | |
|
| |
Miembro registrado 10 mensajes |
|
Publicado el 18,junio 2017 - 01:10 |
Bonjour Quand je fais plusieurs importation de fichiers text j'ai des erreur dans la base ou impossible à l’ouvrir malgres une optimisation et un réindexage
Champ_import1 = "cmpcod,rstref,escapp,escllog,ecscapp,ecsllog,ecscat,ecssexe,eecapp,eellog,stdate,stheure,stlib,stserie,sttour,stchrono,stcomment," Champ_import2 = "ecssq,stplace,sttemps,panom,paprenom,pacat,pasexe,paannai,panat,palic,paclub,paclubnom,paligue,padept,rstnomeq,engerord," Champ_import3 = "eqgnom,padossard,stcouloir,stprfqf" Champ_import = Champ_import1 + Champ_import2 + Champ_import3 SI ErreurDétectée ALORS Erreur(HErreurInfo()) SINON HImporteTexte(Startlist, NomCheminFichier, Champ_import, TAB + Caract(127) + """" + Caract(127) + RC, hImpSansDélimiteur) SI ErreurDétectée ALORS Erreur(HErreurInfo()) FIN HLitPremier(Startlist) TANTQUE HEnDehors() = Faux Startlist.epreuve = Remplace(Startlist.ecsllog,"/","") Startlist.epreuve = Startlist.epreuve + Startlist.stlib Startlist.epreuve = Remplace(Startlist.epreuve," ","") HModifie(Startlist) HLitSuivant(Startlist) FIN HLitPremier(Startlist) TANTQUE HEnDehors() = Faux SI Asc(SansEspace(Startlist.stcouloir)) = 0 ALORS Startlist.stcouloir = "0" HModifie(Startlist) FIN SELON Val(SansEspace(Startlist.stcouloir)) CAS < 10 Startlist.stcouloir = "00" + SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) HModifie(Startlist) CAS < 100 Startlist.stcouloir = "0" + SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) HModifie(Startlist) AUTRE CAS Startlist.stcouloir = SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) HModifie(Startlist) FIN HLitSuivant(Startlist) FIN HRéindexe(Startlist,hNdxNormal) HOptimise(Startlist) je ne sais plus que faire merci |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 1.923 mensajes Popularité : +53 (65 votes) |
|
Publicado el 18,junio 2017 - 08:15 |
Bonjour,
Code simplifié :
Champ_import1 = "cmpcod,rstref,escapp,escllog,ecscapp,ecsllog,ecscat,ecssexe,eecapp,eellog,stdate,stheure,stlib,stserie,sttour,stchrono,stcomment," Champ_import2 = "ecssq,stplace,sttemps,panom,paprenom,pacat,pasexe,paannai,panat,palic,paclub,paclubnom,paligue,padept,rstnomeq,engerord," Champ_import3 = "eqgnom,padossard,stcouloir,stprfqf" Champ_import = Champ_import1 + Champ_import2 + Champ_import3
SI PAS HImporteTexte(Startlist, NomCheminFichier, Champ_import, TAB + Caract(127) + """" + Caract(127) + RC, hImpSansDélimiteur) ALORS Erreur(HErreurInfo()) FIN
POUR TOUT Startlist Startlist.epreuve = Remplace(Startlist.ecsllog,"/","") Startlist.epreuve = Startlist.epreuve + Startlist.stlib Startlist.epreuve = Remplace(Startlist.epreuve," ","")
SI Asc(SansEspace(Startlist.stcouloir)) = 0 ALORS Startlist.stcouloir = "0" FIN
SELON Val(SansEspace(Startlist.stcouloir)) CAS < 10 Startlist.stcouloir = "00" + SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) CAS < 100 Startlist.stcouloir = "0" + SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) AUTRE CAS Startlist.stcouloir = SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) FIN
SI PAS HModifie(Startlist) ALORS Erreur(HErreurInfo()) FIN
FIN
HRéindexe(Startlist,hNdxNormal)
-- Bon dev, Jean-PierreMensaje modificado, 18,junio 2017 - 08:20 |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 10 mensajes |
|
Publicado el 25,junio 2017 - 00:36 |
Bonjour
malgré ce code j'ai toujours des problèmes de base après plusieurs importation de fichiers texte j'ai des erreurs dans la base ou impossible à l’ouvrir malgré une optimisation et un ré indexage
NomCheminFichier est une chaîne NomCheminFichier = fSélecteur(FEN_terrain.Ter_rep_evt, "", "Sélectionnez un fichier ", "List" + TAB + "*.txt", "*.txt") Champ_import est une chaîne Champ_import1 est une chaîne Champ_import2 est une chaîne Champ_import3 est une chaîne
Hj_recherche2 est une chaîne Hj_remplace est une chaîne Hj_remplace2 est une chaîne tabHj_tableau1 est un tableau [1000] chaîne tabHj_tableau2 est un tableau [1000] chaîne Hj_cpt est un entier
SI NomCheminFichier <> "" ALORS Champ_import1 = "cmpcod,rstref,escapp,escllog,ecscapp,ecsllog,ecscat,ecssexe,eecapp,eellog,stdate,stheure,stlib,stserie,sttour,stchrono,stcomment," Champ_import2 = "ecssq,stplace,sttemps,panom,paprenom,pacat,pasexe,paannai,panat,palic,paclub,paclubnom,paligue,padept,rstnomeq,engerord," Champ_import3 = "eqgnom,padossard,stcouloir,stprfqf" Champ_import = Champ_import1 + Champ_import2 + Champ_import3 HSupprimeTout(trans_startlist) HImporteTexte(trans_startlist, NomCheminFichier, Champ_import, TAB + Caract(127) + """" + Caract(127) + RC, hImpSansDélimiteur) SI ErreurDétectée ALORS Erreur(HErreurInfo()) SINON HLitPremier(trans_startlist) Hj_cpt = 1 TANTQUE HEnDehors() = Faux tabHj_tableau2[Hj_cpt]= trans_startlist.eecapp + trans_startlist.ecssexe + trans_startlist.ecscat + trans_startlist.sttour + trans_startlist.stserie HLitSuivant(trans_startlist) Hj_cpt = Hj_cpt + 1 FIN HLitPremier(Startlist) TANTQUE HEnDehors() = Faux Hj_recherche2 = Startlist.eecapp + Startlist.ecssexe + Startlist.ecscat + Startlist.sttour + Startlist.stserie POUR i = 1 A (Hj_cpt-1) SI Hj_recherche2 = tabHj_tableau2[i] ALORS HSupprime(Startlist) FIN FIN HLitSuivant(Startlist) FIN
HLitPremier(trans_startlist) TANTQUE HEnDehors(trans_startlist) = Faux HCopieEnreg(Startlist,trans_startlist,hValDéfaut) HAjoute(Startlist) HLitSuivant(trans_startlist) FIN
POUR TOUT Startlist Startlist.epreuve = Remplace(Startlist.ecsllog,"/","") Startlist.epreuve = Startlist.epreuve + Startlist.stlib Startlist.epreuve = Remplace(Startlist.epreuve," ","") SI Asc(SansEspace(Startlist.stcouloir)) = 0 ALORS Startlist.stcouloir = "0" FIN SELON Val(SansEspace(Startlist.stcouloir)) CAS < 10 Startlist.stcouloir = "00" + SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) CAS < 100 Startlist.stcouloir = "0" + SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) AUTRE CAS Startlist.stcouloir = SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) FIN SI PAS HModifie(Startlist) ALORS Erreur(HErreurInfo()) FIN FIN HLitPremier(epffa) TANTQUE HEnDehors() = Faux tabHj_tableau1[Val(epffa.ep_code_ffa)] = epffa.ep_Type_ep HLitSuivant(epffa) FIN HLitPremier(Startlist) TANTQUE HEnDehors() = Faux Startlist.type_ep = tabHj_tableau1[Val(Startlist.ecscapp)] SI PAS HModifie(Startlist) ALORS Erreur(HErreurInfo()) FIN HLitSuivant(Startlist) FIN HExécuteRequête(REQ_startlist_Nbr_athlete) HLitPremier(REQ_startlist_Nbr_athlete) TANTQUE HEnDehors() = Faux Hj_remplace = REQ_startlist_Nbr_athlete.epreuve + REQ_startlist_Nbr_athlete.sttour + REQ_startlist_Nbr_athlete.stserie Hj_remplace2 = REQ_startlist_Nbr_athlete.Comptage_1 HLitPremier(Startlist) TANTQUE HEnDehors() = Faux SI Startlist.epreuve + Startlist.sttour + Startlist.stserie = Hj_remplace ALORS Startlist.nb_athlete = Hj_remplace2 SI PAS HModifie(Startlist) ALORS Erreur(HErreurInfo()) FIN FIN HLitSuivant(Startlist) FIN HLitSuivant(REQ_startlist_Nbr_athlete) FIN HOptimise(Startlist) HRéindexe(Startlist,hNdxNormal) HAnnuleDéclaration(REQ_startlist_Nbr_athlete) HFerme(Startlist) ToastAffiche("Traitement terminé") FIN FIN
merci de votre aide @+ |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 1.923 mensajes Popularité : +53 (65 votes) |
|
Publicado el 25,junio 2017 - 08:59 |
Bonjour,
Je sais bien que la 1ère chose que l'on demande à quelqu'un qui a un problème est son code, mais la 2ème est : "Erreur, vous avez dit erreur ?" Quel est le message d'erreur ?
Et la 3ème est "Quel est le volume des données à importer" ?
En partant du principe qu'il y a (presque) toujours quelque chose de spécial dans ton code qui provoque le problème, il faut le simplifier à l'extrême pour identifier l'origine du problème !
Donc :
NomCheminFichier est une chaîne NomCheminFichier = fSélecteur(FEN_terrain.Ter_rep_evt, "", "Sélectionnez un fichier ", "List" + TAB + "*.txt", "*.txt") Champ_import est une chaîne
SI NomCheminFichier <> "" ALORS Champ_import = "cmpcod,rstref,escapp,escllog,ecscapp,ecsllog,ecscat,ecssexe,eecapp,eellog,stdate,stheure,stlib,stserie,sttour,stchrono,stcomment," Champ_import += "ecssq,stplace,sttemps,panom,paprenom,pacat,pasexe,paannai,panat,palic,paclub,paclubnom,paligue,padept,rstnomeq,engerord," Champ_import += "eqgnom,padossard,stcouloir,stprfqf"
SI PAS HSupprimeTout(trans_startlist) ALORS Erreur(HErreurInfo()) FIN
SI PAS HImporteTexte(trans_startlist, NomCheminFichier, Champ_import, TAB + Caract(127) + """" + Caract(127) + RC, hImpSansDélimiteur) ALORS Erreur(HErreurInfo()) SINON ToastAffiche("Traitement terminé") FIN
FIN Puis test immédiat d'ouverture dans le CC HFSQL sans réindexation puis avec réindexation.
A tester également : HCréation à la place de HSupprimeTout
Avantage de HSupprimeTout par rapport à l'utilisation de la fonction HCréation : Pour supprimer les enregistrements d'un fichier de données, il est également possible d'utiliser la fonction HCréation. L'utilisation de la fonction HSupprimeTout présente les avantages suivants : • Suppression possible même si des utilisateurs sont connectés au fichier de données. • Gestion automatique des erreurs HFSQL.
-- Bon dev, Jean-PierreMensaje modificado, 25,junio 2017 - 09:01 |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 10 mensajes |
|
Publicado el 25,junio 2017 - 15:36 |
Merci de votre réponse voila l'erreur que j'ai
et je passe par optimiser et réparer pour enlever le problème
Pour répondre à vos questions c'est en consultant le fichier startlist.fic que j'ai cette erreur après plusieurs traitement du programme voir ci-joint le volume d'importation ce sont des fichiers texte de 2 à 300 ou 400 lignes maxi (donc de petit fichiers)
Merci pour tout et de votre aide @+ |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 1.923 mensajes Popularité : +53 (65 votes) |
|
Publicado el 25,junio 2017 - 16:39 |
Bonjour,
Si je comprends bien, vous êtes en HF Classic. Une première optimisation serait de passer en HF C/S.
Sur le volume, il est effectivement petit, mais le nombre de rubriques est important et le nombre de clés est inconnu.
"j'ai cette erreur après plusieurs traitement du programme" Avez-vous l'erreur pendant le traitement ? sur quelle ligne ?
Ma suggestion ci-dessus me paraît la première piste à suivre (voir les nombreux exemples dans l'Aide en ligne et dans ce forum). Cela oblige à modifier légèrement le programme, mais le jeu en vaut la chandelle je pense.
-- Bon dev, Jean-Pierre |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 10 mensajes |
|
Publicado el 25,junio 2017 - 19:41 |
Merci
Je n'ai pas trop envi de passer en HF C/S car c'est plutôt une application monoposte non connecter Le traitement ce fait bien je n'ai pas d'erreur lors de l'exécution mais c'est en consultation du fichier .FIC que j'ai l'erreur comme l'image précédente.
Merci |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 1.923 mensajes Popularité : +53 (65 votes) |
|
Publicado el 25,junio 2017 - 21:11 |
NomCheminFichier est une chaîne NomCheminFichier = fSélecteur(FEN_terrain.Ter_rep_evt, "", "Sélectionnez un fichier ", "List" + TAB + "*.txt", "*.txt") Champ_import est une chaîne
Hj_recherche2 est une chaîne Hj_remplace est une chaîne Hj_remplace2 est une chaîne tabHj_tableau1 est un tableau [1000] chaîne tabHj_tableau2 est un tableau [1000] chaîne Hj_cpt est un entier
SI NomCheminFichier <> "" ALORS Champ_import = "cmpcod,rstref,escapp,escllog,ecscapp,ecsllog,ecscat,ecssexe,eecapp,eellog,stdate,stheure,stlib,stserie,sttour,stchrono,stcomment," Champ_import += "ecssq,stplace,sttemps,panom,paprenom,pacat,pasexe,paannai,panat,palic,paclub,paclubnom,paligue,padept,rstnomeq,engerord," Champ_import += "eqgnom,padossard,stcouloir,stprfqf"
SI PAS HSupprimeTout(trans_startlist) ALORS Erreur(HErreurInfo()) ; RETOUR FIN
SI PAS HImporteTexte(trans_startlist, NomCheminFichier, Champ_import, TAB + Caract(127) + """" + Caract(127) + RC, hImpSansDélimiteur) ALORS Erreur(HErreurInfo()) SINON Hj_cpt = 1 POUT TOUT trans_startlist
tabHj_tableau2[Hj_cpt]= trans_startlist.eecapp + trans_startlist.ecssexe + trans_startlist.ecscat + trans_startlist.sttour + trans_startlist.stserie Hj_cpt ++ FIN
Pour TOUT Startlist Hj_recherche2 = Startlist.eecapp + Startlist.ecssexe + Startlist.ecscat + Startlist.sttour + Startlist.stserie POUR i = 1 A (Hj_cpt-1) SI Hj_recherche2 = tabHj_tableau2[i] ALORS SI PAS HSupprime(Startlist) ALORS Erreur(HErreurInfo()) FIN
FIN FIN FIN
pour TOUT trans_startlist SI PAS HCopieEnreg(Startlist,trans_startlist,hValDéfaut) ALORS Erreur(HErreurInfo()) FIN
SI PAS HAjoute(Startlist) ALORS Erreur(HErreurInfo()) FIN FIN
POUR TOUT Startlist Startlist.epreuve = Remplace(Startlist.ecsllog,"/","") Startlist.epreuve = Startlist.epreuve + Startlist.stlib Startlist.epreuve = Remplace(Startlist.epreuve," ","") SI Asc(SansEspace(Startlist.stcouloir)) = 0 ALORS Startlist.stcouloir = "0" FIN SELON Val(SansEspace(Startlist.stcouloir)) CAS < 10 Startlist.stcouloir = "00" + SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) CAS < 100 Startlist.stcouloir = "0" + SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) AUTRE CAS Startlist.stcouloir = SansEspace(NumériqueVersChaîne(Val(SansEspace(Startlist.stcouloir)))) FIN SI PAS HModifie(Startlist) ALORS Erreur(HErreurInfo()) FIN FIN
pour TOUT epffa tabHj_tableau1[Val(epffa.ep_code_ffa)] = epffa.ep_Type_ep FIN
pour TOUT Startlist Startlist.type_ep = tabHj_tableau1[Val(Startlist.ecscapp)] SI PAS HModifie(Startlist) ALORS Erreur(HErreurInfo()) FIN FIN
SI HExécuteRequête(REQ_startlist_Nbr_athlete) ALORS pour TOUT REQ_startlist_Nbr_athlete Hj_remplace = REQ_startlist_Nbr_athlete.epreuve + REQ_startlist_Nbr_athlete.sttour + REQ_startlist_Nbr_athlete.stserie Hj_remplace2 = REQ_startlist_Nbr_athlete.Comptage_1 pour TOUT Startlist SI Startlist.epreuve + Startlist.sttour + Startlist.stserie = Hj_remplace ALORS Startlist.nb_athlete = Hj_remplace2 SI PAS HModifie(Startlist) ALORS Erreur(HErreurInfo()) FIN FIN FIN FIN
HAnnuleDéclaration(REQ_startlist_Nbr_athlete)
SI PAS HOptimise(Startlist) ALORS Erreur(HErreurInfo()) FIN
ToastAffiche("Traitement terminé") FIN
FIN
-- Bon dev, Jean-Pierre |
| |
| |
| | | |
|
| | |
| |
Publicado el 26,junio 2017 - 12:16 |
Dans un souci de simplification , je remplacerais déjà les 6 ou 7 lignes "numeriqueverschaine" par :
Startlist.stcouloir = NumériqueVersChaîne( Startlist.stcouloir , "03d" )
Le paramètre "03d" permet de dire : Compléter à gauche par des 0.
ou encore , tu crées une fonction complete_a_gauche similaire à ceci, et tu fais Startlist.stcouloir = complete_a_gauche ( sansespace( Startlist.stcouloir ), 3, "0")
Procedure complete_a_gauche ( sch, n=3, filler = "0") t est un entier t = Taille(sch ) RENVOYER Répète( filler, n-t) + sch
Sinon, le truc qui me gène un peu , c'est de combiner dans un même code un hexecuteRequete() avec des hmodifie() et hajoute().
Le fait que tu utilises 6 lignes de code pour numeriqueverschaine() ... ca me fait quand même vraiment peur. Ici tu présentes un code de 100 lignes... quelque chose me dit que bien écrit, il suffit de 20 lignes. Et 5 fois moins de lignes, c'est 5 fois moins de problèmes. |
| |
| |
| | | |
|
| | | | |
| | |
|