Definindo o Tamanho de uma String com o Tamanho do Campo(SX3) com a Função AvKey em ADVPL

Tempo de leitura: 1 minuto

A função AvKey em ADVPL define o tamanho de uma string utilizando o tamanho de um campo(SX3) do dicionário do TOTVS Protheus. Essa função é muito útil em situações onde queremos encontrar o conteúdo de índice posicionado, usando a função DBSeek por exemplo.  Ela é uma das funções de manipulação de string em ADVPL. 

 

Sintaxe:

AvKey(cStr,cCampSX3)

 

Parâmetro(s):

Retorno:

 

Exemplo da função AvKey em ADVPL:

Veja o código de exemplo:
#include 'protheus.ch'
/*{Protheus.doc} User Function fAvKey
    (Essa função tem por finalidade mostrar a função de Manipulação de String AvKey em ADVPL)
    @type  Function
    @author Adilio Costa
    @since 10/02/2025
    @version 1.0
@?Inscreva-se no Blog ProtheusAdvpl:
@?Inscreva-se no Canal ProtheusAdvpl:
@?Siga-nos no Instagram:
@?Conheça os Cursos e Formações do ProtheusAdvpl:
 
|Se esse conteúdo foi útil pra você nos ajude divulgando
ele e nossas redes sociais!!|
 
*/
User Function fAvKey()
    Local aArea   := FWGetArea()
    Local cCodP := "000001"
    Local cDesP := "Portal ProtheusAdvpl"
    Local cCampo1SX3 := "B1_DESC"
    Local cCampo2SX3 := "B1_COD"
    Local cDescProd := AvKey(cDesP,cCampo1SX3)
    Local cCodProd := AvKey(cCodP,cCampo2SX3)
 
    DBSelectArea("SB1")
    SB1->(DBSetOrder(3)) //B1_FILIAL+B1_DESC+B1_COD
 
    If(FWxFilial("SB1")+cDesP+cCodP)
        FWAlertInfo("Foi encontrado a descrição e o produto!","Função AvKey")
    Else
        FWAlertInfo("Não foi encontrado a descrição e o produto!","Função AvKey")
    EndIf
 
    //Strings formatadas com AvKey
    If(FWxFilial("SB1")+cDescProd+cCodProd)
        FWAlertInfo("Foi encontrado a descrição e o produto!","Função AvKey")
    Else
        FWAlertInfo("Não foi encontrado a descrição e o produto!","Função AvKey")
    EndIf
 
 
    FWRestArea(aArea)
 
Return

 

É isso aí, finalizamos aqui o post aqui do Blog ProtheusAdvpl. Caso tenha ficado alguma dúvida deixe seu comentário ou nos envie um e-mail para adiliocosta@protheusadvpl.com.br, até um próximo post, grande abraço e fica com Deus.

 
Receba as últimas atualizações do ProtheusAdvpl
Deixe seu melhor email
Nós respeitamos sua privacidade.

27 Comentários


  1. Just desire to say your article is as astonishing. The clearness in your post is simply spectacular and i could assume you are an expert on this subject. Well with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please continue the gratifying work.


  2. Wow! This blog looks just like my old one! It’s on a entirely different topic but it has pretty much the same page layout and design. Outstanding choice of colors!|


  3. Thanks for any other informative blog. Where else could I get that type of information written in such an ideal approach? I have a mission that I am simply now working on, and I have been on the look out for such info.|


  4. I every time used to study piece of writing in news papers but now as I am a user of internet so from now I am using net for content, thanks to web.|


  5. Of late, nearly all of academic research groups finding out ANNs for inventory forecasting seem to be using an ensemble of independent ANNs strategies more ceaselessly, with larger success.


  6. There’s nothing like the thrill of speeding across the water in a well-maintained boat. Whether it’s a sleek speedboat or a jet-powered vessel, performance boats offer an adrenaline rush. When buying a boat, consider factors like horsepower, fuel efficiency, and handling. Test-driving a boat before purchasing can help you understand how it feels on the water. The right boat will make every trip a thrilling experience.


  7. There’s something special about spending time on the water, away from the stress of daily life. A boat allows you to explore new places, go fishing in the best spots, or simply relax with friends and family. Many people buy boats for weekend getaways, while others use them for full-time living. The choice depends on the type of boating experience you want. Sailboats are great for those who enjoy the challenge of wind-powered travel, while powerboats offer speed and convenience. No matter what type you choose, owning a boat means enjoying the open water on your terms.


  8. Web 版Skype 是享受您在傳統型應用程式中熟悉的Skype 功能最簡單的方法,而不需要下載。 您可以登入Web 版Skype 然後立即開始聊天。https://www.skypeie.com


  9. Wow! Thank you! I always needed to write on my website something like that. Can I take a portion of your post to my blog?


  10. Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!


  11. incrível este conteúdo. Gostei bastante. Aproveitem e vejam este conteúdo. informações, novidades e muito mais. Não deixem de acessar para saber mais. Obrigado a todos e até mais. 🙂


  12. “TheKingComix is a go-to platform for comic enthusiasts who love immersive storytelling and stunning artwork. Whether you’re into action, fantasy, or slice-of-life comics, this site offers a diverse collection to explore. The user-friendly interface and regular updates make it a must-visit for comic lovers. Highly recommended for anyone looking to dive into a world of creativity!”

    website:https://thekingcomix.com/


  13. Este site é realmente demais. Sempre que acesso eu encontro coisas incríveis Você também pode acessar o nosso site e descobrir mais detalhes! informaçõesexclusivas. Venha saber mais agora! 🙂

Comentários encerrados.