ReadVar

Tempo de leitura: 3 minutos

Olá, no post de hoje iremos falar da função ReadVar em ADVPL. A finalidade dessa função é fornecer o nome do campo(ex:M->D1_DOC) ou variável(cCPF) de onde estamos digitando algum valor. Ela muito útil para fazermos validações baseada no campo que estamos digitando. Ela também é uma das funções de Interface Visual em ADVPL. 

Podemos usar a função ReadVar em conjunto com o operador macro & para obter o conteúdo do campo ou variável a qual ReadVar referencia. Ex. &(ReadVar).

 

Sintaxe:

ReadVar()

 

Parâmetro(s):

——-

Retorno:

 

 

Exemplo da função ReadVar em ADVPL para obtermos o nome da variável de um objeto do tipo Get:

#include 'protheus.ch'
#include  'totvs.ch'

/*{Protheus.doc} User Function fReadVar
    (Essa função tem por finalidade mostrar a função ReadVar em ADVPL)
    @type  Function
    @author Adilio Costa
    @since 24/04/2024
    @version Protheus 12.1.2210
   @Inscreva-se no Blog ProtheusAdvpl:
https://www.protheusadvpl.com.br
@Inscreva-se no Canal ProtheusAdvpl:
https://www.youtube.com/protheusadvpl
@Siga-nos no Instagram:
https://www.instagram.com/protheusadvpl
@Conheça os Cursos do ProtheusAdvpl:
https://hotmart.com/pt-br/club/protheusadvpl
|Se esse conteúdo foi útil pra você nos ajude divulgando 
ele e nossas redes sociais!!|
*/
User Function fReadVar()

	@ 010,050 MSGET cCPF SIZE 55,11 OF oDlg PIXEL PICTURE "@R 999.999.999-99";
		VALID U_Valida()

	@ 050,050 MSGET cCNPJ SIZE 55,11 OF oDlg PIXEL PICTURE "@R 99.999.999/9999-99";
		VALID U_Valida()

Return

User Function Valida()
	Local cCampo
	Local cConteudo
	Local lValid := .F.

	//Obtendo o nome variável
	cCampo := ReadVar()
	//Otendo o conteúdo da variável
	cConteudo := &(ReadVar())

	If(cCampo == "cCPF")
		MsgInfo("Você digitou o CPF:"+cConteudo,"Função ReadVar")
		lValid := ValCPF(cConteudo)
	ElseIf(cCampo == "cCNPJ")
		MsgInfo("Você digitou o CNPJ:"+cConteudo,"Função ReadVar")
	Else
		MsgInfo("Campo inválido!","Função ReadVar")
		lValid := ValCNPJ(cConteudo)
	EndIf


Return lValid


 

Exemplo da função ReadVar em ADVPL para obtermos o nome do campo na tela do documento de entrada(MATA103):

#include 'protheus.ch'
#include  'totvs.ch'

/*{Protheus.doc} User Function fReadVar
    (Essa função tem por finalidade mostrar a função ReadVar em ADVPL)
    @type  Function
    @author Adilio Costa
    @since 24/04/2024
    @version Protheus 12.1.2210
   @Inscreva-se no Blog ProtheusAdvpl:
https://www.protheusadvpl.com.br
@Inscreva-se no Canal ProtheusAdvpl:
https://www.youtube.com/protheusadvpl
@Siga-nos no Instagram:
https://www.instagram.com/protheusadvpl
@Conheça os Cursos do ProtheusAdvpl:
https://hotmart.com/pt-br/club/protheusadvpl
|Se esse conteúdo foi útil pra você nos ajude divulgando 
ele e nossas redes sociais!!|
*/

User Function VerCampo()

	Local cCampoSD1 := ""
	Local cContSD1  := ""

//Obtém o nome do campo da tabela SD1 a qual está sendo digitado
	cCampoSD1 := ReadVar()

//Obtém o conteúdo do campo da tabela SD1 que foi digitado
	cContSD1 := &(ReadVar())


	If(cCampoSD1 == "M->D1_DOC")
		MsgInfo("Você digitou o documento:"+cContSD1)
	ElseIf(cCampoSD1 == "M->D1_SERIE")
		MsgInfo("Você digitou a série:"+cContSD1)
	ElseIf(cCampoSD1 == "M->D1_TES")
		MsgInfo("Você digitou a TES:"+cContSD1)
	Else
		MsgInfo("Você digitou outro campo de conteúdo:"+cContSD1)
	EndIf

	
Return

 

 

É isso aí, finalizamos aqui mais um post no 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.

73 Comentários


  1. My brother suggested I might like this website He was totally right This post actually made my day You cannt imagine just how much time I had spent for this information Thanks

    Responder

  2. My brother suggested I might like this website He was totally right This post actually made my day You cannt imagine just how much time I had spent for this information Thanks

    Responder

  3. I have been surfing online more than 3 hours today yet I never found any interesting article like yours It is pretty worth enough for me In my opinion if all web owners and bloggers made good content as you did the web will be much more useful than ever before

    Responder

  4. I have been surfing online more than 3 hours today yet I never found any interesting article like yours It is pretty worth enough for me In my opinion if all web owners and bloggers made good content as you did the web will be much more useful than ever before

    Responder

  5. Simply desire to say your article is as surprising The clearness in your post is simply excellent and i could assume you are an expert on this subject Fine with your permission let me to grab your feed to keep up to date with forthcoming post Thanks a million and please carry on the gratifying work

    Responder

  6. I loved as much as you will receive carried out right here The sketch is attractive your authored material stylish nonetheless you command get got an impatience over that you wish be delivering the following unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you shield this hike

    Responder

  7. Your blog is a treasure trove of valuable insights and thought-provoking commentary. Your dedication to your craft is evident in every word you write. Keep up the fantastic work!

    Responder

  8. I have been browsing online more than three hours today yet I never found any interesting article like yours It is pretty worth enough for me In my view if all website owners and bloggers made good content as you did the internet will be a lot more useful than ever before

    Responder

  9. I do not even know how I ended up here but I thought this post was great I dont know who you are but definitely youre going to a famous blogger if you arent already Cheers

    Responder

  10. Your blog is a beacon of light in the often murky waters of online content. Your thoughtful analysis and insightful commentary never fail to leave a lasting impression. Keep up the amazing work!

    Responder

  11. I was suggested this web site by my cousin Im not sure whether this post is written by him as no one else know such detailed about my trouble You are incredible Thanks

    Responder

  12. 먹튀검증 커뮤니티에 참여하여 안전한 온라인 놀이터 정보를 공유하고 받아보세요! 다른 사용자들의 경험과 후기를 통해 사기 피해를 예방하고 안전하게 게임을 즐길 수 있습니다.

    Responder

  13. Thanks I have recently been looking for info about this subject for a while and yours is the greatest I have discovered so far However what in regards to the bottom line Are you certain in regards to the supply

    Responder

  14. 먹튀검증커뮤니티에 참여하여 안전한 온라인 놀이터 정보를 공유하고 받아보세요! 다른 사용자들의 경험과 후기를 통해 사기 피해를 예방하고 안전하게 게임을 즐길 수 있습니다.

    Responder

  15. Maxwin500 adalah link alternatif main game slot online terpopuler dengan fitur paling lengkap yang gampang menang maxwin hari ini 2024.

    Responder

  16. Maxwin500 adalah link alternatif main game slot online terpopuler dengan fitur paling lengkap yang gampang menang maxwin hari ini 2024.

    Responder

  17. Maxwin500 adalah link alternatif main game slot online terpopuler dengan fitur paling lengkap yang gampang menang maxwin hari ini 2024.

    Responder

  18. Maxwin500 adalah link alternatif main game slot online terpopuler dengan fitur paling lengkap yang gampang menang maxwin hari ini 2024.

    Responder

  19. Your blog is a testament to your expertise and dedication to your craft. I’m constantly impressed by the depth of your knowledge and the clarity of your explanations. Keep up the amazing work!

    Responder

  20. Your writing is like a breath of fresh air in the often stale world of online content. Your unique perspective and engaging style set you apart from the crowd. Thank you for sharing your talents with us.

    Responder

  21. Your passion for your subject matter shines through in every post. It’s clear that you genuinely care about sharing knowledge and making a positive impact on your readers. Kudos to you!

    Responder

  22. you are in reality a just right webmaster The site loading velocity is incredible It seems that you are doing any unique trick In addition The contents are masterwork you have performed a wonderful task on this topic

    Responder

  23. helloI like your writing very so much proportion we keep up a correspondence extra approximately your post on AOL I need an expert in this space to unravel my problem May be that is you Taking a look forward to see you

    Responder

  24. “The depth of analysis in this blog post is impressive. It’s refreshing to find a resource that not only educates but also inspires action. The clear writing style and thoughtful explanations make complex concepts accessible. Keep up the great work!”

    Responder

  25. Thank you immensely for the wealth of knowledge you’ve provided on your platform. Your content has been instrumental in expanding my understanding, and I’m eager to continue exploring all that your site has to offer.

    Responder

  26. Thank you immensely for the wealth of knowledge you’ve provided on your platform. Your content has been instrumental in expanding my understanding, and I’m eager to continue exploring all that your site has to offer.

    Responder

  27. Thank you immensely for the wealth of knowledge you’ve provided on your platform. Your content has been instrumental in expanding my understanding, and I’m eager to continue exploring all that your site has to offer.

    Responder

  28. Thank you immensely for the wealth of knowledge you’ve provided on your platform. Your content has been instrumental in expanding my understanding, and I’m eager to continue exploring all that your site has to offer.

    Responder

  29. Thank you immensely for the wealth of knowledge you’ve provided on your platform. Your content has been instrumental in expanding my understanding, and I’m eager to continue exploring all that your site has to offer.

    Responder

  30. Thank you for providing such valuable information on your site. I found it incredibly useful and will definitely be returning for more.

    Responder

  31. “Thank you for addressing such an important topic with clarity and authority. The information shared here is timely and relevant, and I appreciate the effort put into providing actionable advice. Looking forward to reading more from this blog!”

    Responder

  32. Your dedication to providing enriching content hasn’t gone unnoticed. I’m continually impressed by the depth and breadth of information available on your platform. Thank you for being a reliable source of enlightenment!

    Responder

  33. I can’t thank you enough for the wealth of knowledge you’ve provided on your platform. Your content has been instrumental in broadening my horizons, and I’m excited to see what more I can learn from your resources. Here’s to continued growth and learning!

    Responder

  34. I wanted to take a moment to express my gratitude for the incredible work you’re doing. Your platform has become an invaluable resource for me, and I’m constantly amazed by the breadth of topics covered. Thank you for being a guiding light in the pursuit of knowledge!

    Responder

  35. Thank you for being a beacon of knowledge and inspiration in the digital landscape. Your platform has become my go-to resource for learning, and I’m continually impressed by the caliber of content you deliver. Keep up the excellent work!

    Responder

  36. Thank you for being a beacon of knowledge in a sea of information. Your platform stands out for its quality content and user-friendly interface. I’m grateful for the opportunity to learn from such a reputable source!

    Responder

  37. Your platform has exceeded my expectations in every way possible. The depth of insights available is truly impressive, and I’m thankful for the opportunity to learn from such a reputable source. Here’s to many more enlightening discoveries!

    Responder

  38. Your website has become my go-to resource for insightful content. Thank you for consistently delivering valuable information that helps me grow. I’ll definitely be back for more!

    Responder

  39. Thank you for being a beacon of knowledge in a sea of information. Your platform stands out for its quality content and user-friendly interface. I’m grateful for the opportunity to learn from such a reputable source!

    Responder

  40. Thank you for being a constant source of inspiration and knowledge. Your platform has become my go-to destination for expanding my understanding of various subjects, and I’m grateful for the impact it’s had on my life. Keep up the fantastic work!

    Responder

  41. Your platform has exceeded my expectations in every way possible. The depth of insights available is truly impressive, and I’m thankful for the opportunity to learn from such a reputable source. Here’s to many more enlightening discoveries!

    Responder

  42. Your platform has exceeded my expectations in every way possible. The depth of insights available is truly impressive, and I’m thankful for the opportunity to learn from such a reputable source. Here’s to many more enlightening discoveries!

    Responder

  43. In addition, I found your article to be very well-researched and substantiated. The data and case studies you provided lend credibility to your arguments and demonstrate the potential for success when targeting the right niche. Thank you for putting so much thought and effort into creating this comprehensive resource.

    Responder

  44. In addition, I found your article to be very well-researched and substantiated. The data and case studies you provided lend credibility to your arguments and demonstrate the potential for success when targeting the right niche. Thank you for putting so much thought and effort into creating this comprehensive resource.

    Responder

  45. “The depth of analysis in this blog post is impressive. It’s refreshing to find a resource that not only educates but also inspires action. The clear writing style and thoughtful explanations make complex concepts accessible. Keep up the great work!”

    Responder

  46. I appreciate how the article encourages readers to take action based on the information presented.

    Responder

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *