0

while loop for n evaluations

 
Good Morning. I am trying to do n amount of data, everything is in a while loop. Is there a way to change the step number? Or does it change within the while loop?

I hope you can support me, I am using a translator and I am new to met / cal.

1.026 WHILE (cont <= n_gag)

################ Celdas fila 1
# Seleccionar Columna A, Valor Nominal
1.027 MATH ColA = "A"
1.028 MATH myCell = ColA & cecont
1.029 LIB COM selectedCell = worksheet.Range[myCell];
1.030 LIB selectedCell.Select();
1.031 MATH nom=0
1.032 LIB nom=selectedCell.FormulaR1C1;
1.033 MATH MEM = nom

# Seleccionar Columna B, Valor Actual
1.034 MATH ColB = "B"
1.035 MATH myCell = ColB & cecont
1.036 LIB COM selectedCell = worksheet.Range[myCell];
1.037 LIB selectedCell.Select();
1.038 MATH act=0
1.039 LIB act=selectedCell.FormulaR1C1;
1.040 MATH MEM1 = act

# Seleccionar Columna C, Incertidumbre CMC
1.041 MATH ColC = "C"
1.042 MATH myCell = ColC & cecont
1.043 LIB COM selectedCell = worksheet.Range[myCell];
1.044 LIB selectedCell.Select();
1.045 MATH Inc=0
1.046 LIB Inc=selectedCell.FormulaR1C1;
1.047 MATH M[1] = Inc

# Seleccionar Columna D, Tolerancia Gauge
1.048 MATH ColD = "D"
1.049 MATH myCell = ColD & cecont
1.050 LIB COM selectedCell = worksheet.Range[myCell];
1.051 LIB selectedCell.Select();
1.052 MATH Tol=0
1.053 LIB Tol=selectedCell.FormulaR1C1;
1.054 MATH M[2] =Tol

#1.055 DISP [V Name] Valor Nom [MEM]
# 1.055 DISP [V Act] Valor Real [MEM1]
#1.055 DISP [V Inc] Valor Incert [M1]
#1.055 DISP [V Tol] Valor Tol [M2]

1.055 TARGET
1.056 MATH MEM1 = nom
1.057 ACC 'in' M1U
1.058 MATH MEM = act
1.059 MEMCX 'in' -M2U

2.001 TARGET
2.002 MATH cont = cont + 1
2.003 MATH cecont = cecont + 1
#2.003 MATH MEM = cont

2.004 MATH indice=2
2.005 ENDW

3 comments

Date Votes
1
Avatar
Rene Buske

Hello Diego,

each evaluation needs own database step, otherwise only the latest is recorded. So you need to call a sub procedure, that is doing the job for you. I would use also your reading of the excel file in a different way as  Structure of an Array at start. So it is more reliable. But this is another point. Here I made your sample as you can get it working:

Keep in mind if you need a value in database(measurement evaluation) you need a new step for it. Keep it simple - it is METCAL, not a coding language;)  Ping me if you need further help: calhelp.de

0
Avatar
Diego Mazariegos

@Rene Buske.

I appreciate the support.
I was hoping to be able to put everything in a loop and avoid excess code, it is an excellent idea to use arrays, I will work on it.
one more question, is it possible to create a file opening window?

Greetings.
0
Avatar
Rene Buske

> is it possible to create a file opening window?

 

yes you can do. Use dos fsc to start a windows batch to use windows open form. I work since years with such system. With dosdose.dat you can get the choosen path back from batch to metcal variable. This works very stable and is easy.

Please sign in to leave a comment.