0

COMPARAR SI HAY OTRO VALOR IGUAL EN UN CAMPO DE UNA TABLA

HOLA NO SE COMO SE HACE PARA QUE NO PUEDA ESCRIBIR EL VALOR EN UN CAMPO SI HAY OTRO IGUAL EN LA TABLA. POR EJEMPLO EL CIF DE UNA EMPRESA SI YA HAY OTRO IGUAL

6 replies

null
    • JGM
    • Jose_Monteiro
    • 2 yrs ago
    • Reported - view

    Hola,

    Suponiendo que su tabla se llama Tabela3 y el campo CIF, el siguiente código le advierte si ya hay un número igual en la tabla y borra el campo en este caso:

    let x := CIF;
    let n := cnt((select Tabela3 where CIF = x).CIF);
    if n > 1 then
        alert("Numero duplicado");
        CIF := void
    end

    El código debe colocarse en el campo Trigger After Update del CIF.

    • GERENCIA
    • 2 yrs ago
    • Reported - view

    MUCHISIMAS GRACIAS, SOY NUEVO EN ESTO JEJEJE, FUNCIONA BIEN PERO LA PARTE DE ALERT NO ME HACE NADA.

    ¿PORQUE PUEDE SER?

    SI ME BORRA EL CIF PERO NO SALE EL MENSAJE 

     

    UN SALUDO

    • Fred
    • 2 yrs ago
    • Reported - view

    Sounds like you are using the cloud version. Alerts do no work in triggers, becausee triggers happen on the server side.

     

    If you put the code into a button then you will see an alert, because buttons happen on the client side.

     

    Google Translate:

     

    Parece que estás usando la versión en la nube. Las alertas no funcionan en los desencadenantes, porque los desencadenantes ocurren en el lado del servidor.

    Si pones el código en un botón, verás una alerta, porque los botones se encuentran en el lado del cliente.

    • JGM
    • Jose_Monteiro
    • 2 yrs ago
    • Reported - view

    I wasn't aware of this particular feature of the triggers and buttons.
    I don't use Ninox on the Cloud but on my Mac.
    Thanks for the clarification.

    Another way to solve the problem so that you don't have to create a button is to do without the alert() and do:
    CIF := "Duplicate number" ;
    If this message appears in the CIF field, you will know that there is a duplicated value and you can delete it manually.

    Google translate:

    No estaba al tanto de esta característica particular de los disparadores y botones.
    No uso Ninox en la nube, sino en mi Mac.
    Gracias por la aclaración.
    Otra forma de resolver el problema para que no tenga que crear un botón es prescindir de la alerta () y hacer:
    CIF := "Número duplicado";
    Si aparece este mensaje en el campo CIF, sabrá que hay un valor duplicado y podrá eliminarlo manualmente.

    • JGM
    • Jose_Monteiro
    • 2 yrs ago
    • Reported - view

    Em Português:
    Ou mais simples ainda, é retirar o comando alert();
    Se depois de digitar um CIF o campo ficar em branco é porque o número entrado é um duplicado.

    In English:
    Or even simpler is removing the alert() command;
    If, after typing a CIF, the field is left blank, it means that the number entered is a duplicate.

    En español:
    O incluso más simple es eliminar el comando alert ();
    Si, después de escribir un CIF, el campo se deja en blanco, significa que el número ingresado es un duplicado.

    • GERENCIA
    • 2 yrs ago
    • Reported - view

    Thank you for all!!! It's runs ok!!!

Content aside

  • 2 yrs agoLast active
  • 6Replies
  • 351Views
  • 1 Following