form2 send data to form1 with count script

form2 send data to form1 with count script

Hi,

I can't find the correct script tu autonumber data filled in form1 with form2. Any help?

Thanks,

Mic

on success form2

  1. if (count(form1[Lugar == input.Lugar])  ==  0)
  2. {
  3.     input.Numero = 1;
  4. }
  5. else
  6. {
  7.     highestMatchingRecord  =  form1 [Lugar == input.Lugar] sort by  Numero desc range from 1 to 1;
  8.     number = (highestMatchingRecord.Numero  +  1);
  9. }
  10. if (count(form1[Numero == input.Numero.toLong()])  >  0)
  11. {
  12.     rec  =  form1  [Numero == input.Numero.toLong()];
  13.     if (input.Numero  ==  null)
  14.     {
  15.         input.Numero = "";
  16.     }
  17.     rec.Status = "Option";
  18.     rec.Numero = Number;
  19.     rec.Nome = input.Nome;
  20.     rec.Sobrenome = input.Sobrenome;
  21.     rec.Lugar = "Option";
  22.     rec.Dia = zoho.currentdate;
  23. }