GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
WINDEV 2024
→
Json\variant - delete member
Json\variant - delete member
Iniciado por Mark Crichton, mar., 22 2018 3:17 AM - 3 respostas
Conecte-se…
Mark Crichton
#1
Publicado em março, 22 2018 - 3:17 AM
Hi
Can anyone help with deleting members for either Json on Variant.
I am updating invoices , and get Json from the API via Httprequest.
I then do JsonToVariant and make the changes to some of the members and now need to pass the Json back to the API via VariantToJson and all shoul dbe good.
How ever I need to delete certain memebrs that I must NOT pass back to the api.
Whats the easiest way to do this .
EG: vMyJson.RowID = 1224 needs to be deleted
looking for a member delete option ?
Denunciar
0
0
Guy Moins
#2
Membro registado
7 mensagems
Publicado em março, 09 2021 - 8:17 AM
Hello, did you find a way to do it ?
Thanks, Guy
Denunciar
0
0
Andrea Chiadò Piat
#3
Membro registado
56 mensagems
Popularité : +2 (2 votes)
Publicado em março, 09 2021 - 10:02 AM
Hello,
when you use JsonToVariant, your result is probably an array of variant.
So, have you tried to use ArrayDelete?
Example:
vMyVar is Variant
arrMyVar is array of Variant
vMyVar.Name="Paperino"
vMyVar.Address="Paperopoli"
ArrayAdd(arrMyVar,vMyVar)
vMyVar.Name="Topolino"
vMyVar.Address="Topolinia"
ArrayAdd(arrMyVar,vMyVar)
vMyVar.Name="Pippo"
vMyVar.Address="Topolinia"
ArrayAdd(arrMyVar,vMyVar)
vMyVar.Name="Pluto"
vMyVar.Address="Pippo's home"
ArrayAdd(arrMyVar,vMyVar)
MyJson is JSON=VariantToJSON(arrMyVar)
//MyJson has 4 elements
ArrayDelete(MyJson,3)
//MyJson has 3 elements
Hope this helps
Andrea
Denunciar
0
0
Greg dlv
#4
Publicado em novembro, 02 2023 - 3:04 PM
Hi,
A bit late, but here's how to do it for people finding this thread nowadays :
You have to use the ..Membre property of the variant; as it is an array containing all members, you can delete members using it.
myVar est un Variant
myVar.memb1 = "ToKeep"
myVar.memb2 = "ToDelete"
POUR TOUT myMember,ind de myvar..Membre
SI myMember..nom = "memb2" ALORS
Supprime(myVar..Membre,ind)
SORTIR
FIN
FIN
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