Árvore de páginas

Altera em tempo de execução o comportamento da entrada de dados e display dos tipos de variáveis decimal.

Sintaxe

let ret = SetClientDecimalSymbol(Param1)
 

Parâmetros

Nome

Tipo

Descrição

Obrigatório

Referência

ret

Lógico

Se verdadeiro(True), a alteração foi realizada com sucesso; caso contrário, falso(False) o comando não pode ser executado.

X

 

Param1

Texto

Definição do dbmoney: "." ou ",".

 

 

 

Observações

  • A chamada a essa função pode ser realizada uma única vez durante a execução da thread. Demais chamadas dessa função apresenta uma mensagem de WARNING no console do servidor: Client decimal symbol already updated by SetClientDecimalSymbol function
  • Disponivel em builds iguais ou superiores a 7.00.131227A

Exemplos

Exemplo 1
 DATABASE logix
  DEFINE sql_stmt CHAR(500)
  DEFINE where_clause CHAR(500)
  DEFINE i smallint            
  DEFINE x char(1)
  DEFINE lr_dados RECORD
                  valor DECIMAL(15,3),
                  texto CHAR(20)
                  END RECORD
MAIN
  DEFER INTERRUPT
  
  create temp table teste_construct (valor decimal(15,3),
                                texto char(20))
  insert into teste_construct values (10.01,'10.01')
  insert into teste_construct values (10.01,'10,01')
  insert into teste_construct values (11.25,'11.25')
  insert into teste_construct values (11.25,'11,25')
  insert into teste_construct values (1.2,'1.2')
  insert into teste_construct values (1.2,'1,2')
  OPEN WINDOW w_teste AT 2,2  WITH FORM "tec-2330"        
       ATTRIBUTE(BORDER, MESSAGE LINE LAST, PROMPT LINE LAST)
       
  DISPLAY "DBMONEY VALOR ATUAL = ",fgl_getenv("DBMONEY")  AT 03,02 attribute(reverse) 
  
  MENU "OPÇÃO: "
  COMMAND "INPUT"
    call executa_input()
  COMMAND "CONSTRUCT" 
    call executa_construct()
  COMMAND "SETAR PONTO"
      call setdecimal()
  COMMAND "FIM"
    EXIT MENU
  END MENU
  CLOSE WINDOW w_teste
END MAIN
FUNCTION executa_construct()
  LET int_flag = 0
  WHILE int_flag = 0                     
      DISPLAY 78 spaces at 13,2
      CONSTRUCT where_clause ON valor,
                                texto
                           FROM valor,
                                texto
      if int_flag <> 0 THEN       
         EXIT WHILE
      END IF  
      DISPLAY "WHERE: "||where_clause at 13,2 attribute(reverse) 
      CALL conout("WHERE: "||where_clause CLIPPED)
      LET sql_stmt = "select * FROM teste_construct where ",where_clause
    
      prepare var_teste from sql_stmt
      declare cq_cursor cursor FOR var_teste
      LET i = 0     
      FOREACH cq_cursor INTO lr_dados.*
         LET i = i + 1
         PROMPT "registro encontrado  ",i USING "<<<&",": "," valor: "||lr_dados.valor," texto: "||lr_dados.texto
                for char x 
      END FOREACH                     
      IF i = 0 THEN
         PROMPT "Não encontrou registro..." FOR char x
      END IF
  END WHILE
  DISPLAY 78 spaces at 13,2
END FUNCTION
FUNCTION executa_input()
   initialize lr_dados.* TO NULL
         
   LET int_flag = 0
   INPUT by name lr_dados.* WITHOUT DEFAULTS
END FUNCTION
                 
FUNCTION setdecimal()
    call conout("teste de SetClientDecimalSymbol")
    call SetClientDecimalSymbol(".")
END FUNCTION
tec-2330.per
DATABASE FORMONLY
SCREEN
{
-----------------------------------------------------------------------------
            TESTE CONSTRUCT CAMPO DECIMAL E TEXTO (SEPARADOR DECIMAIS)
valores no BD: 10.01              valor: [b1               ]
               11.25
                1.2               texto: [b2               ]
}
END
ATTRIBUTES
b1   = formonly.valor type decimal;
b2   = formonly.texto type char;
END

 

 

 

 

  • Sem rótulos