GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
WINDEV 2024
→
import data from Excel
import data from Excel
Iniciado por VEGEboss, dez., 23 2019 6:03 PM - 1 resposta
Conecte-se…
VEGEboss
#1
Membro registado
88 mensagems
Popularité : +2 (2 votes)
Publicado em dezembro, 23 2019 - 6:03 PM
hello folks
please consider this very small piece of code
HImportXLS
(
Shoes_Tag
,
My_Excel_File
,
1
,
""
,
hImpTestDuplicates
+
hImpIgnoreFirstLine
)
IF
ErrorOccurred
THEN
Error
(
HErrorInfo
(
)
)
END
and the structure os the related table (I don't know if can be useful, anyway here it is)
my problem is: every time the code above is launched, Windev add ALL the rows of the Excel sheet without any regard to the Unique Key (DataNumero, the last row in the picture) defined inthe table structure.
1) the file Excel and the .FIC table has the same structure
2) at every run I don't receive any error message and the table is re-re-re-re-filled with ALL the Excel rows
3) I think that, when importing data, Windev has to do ALL the "dirty work", automatic fillng the keys and checking the index
Where am I doing wrong?
Denunciar
0
0
Olivier
#2
Publicado em dezembro, 27 2019 - 4:12 PM
Hi VEGEboss,
"hImpTestDuplicates" will only avoid to have duplicates if you use it with "hCopyAutoId" (hCopyAutoId+hImpTestDuplicates).
So this option won't help.
1) The easiest way to do it is to use "hImpCreation", all the rows of your file will be deleted and re-created.
2) If you want to import only the last rows. You have to use an intermediate file:
HImportXLS(Shoes_Tag_Intermediate, My_Excel_File, 1, "", hImpCreation+hImpIgnoreFirstLine)
When this intermediate file is created:
- Get the highest ID of "Shoes_Tag"
- Then, for all rows of "Shoes_Tag_Intermediate" where ID > Highest ID of "Shoes_Tag", HCopyRecord(Shoes_Tag,Shoes_Tag_Intermediate)
Could it help?
Regards
Olivier
Denunciar
0
0
→ Voltar para WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versões anteriores)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Tipo de Pesquisa
Apenas tópicos
Todas as mensagens
Período de pesquisa
Qualquer momento
Última hora
Últimas 24 horas
Semana passada
Mês passado
Ano passado
Cancelar
Pré-visualização da sua mensagem
Adicionar imagem
Importar uma imagem de uma URL
Enviar uma imagem a partir do seu disco
Deixe um ficheiro ou clique em "Procurar ..."
ou
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto