Please see attached data
1.Create folder C:\FSDS\INPUT and put IT_00000001_000_1_IN.csv
2.Create folder C:\FSDS\DB_Diametri and put A00.cvs in it
3.Create folder C:\FSDS\DB_Curve and put A00B6D.cvs in it
4.Create Folder C:\FSDS\OUTPUT_TP
5.Calculate FCP1InitializePressureTable_20180531.mcdx : An Excel file will be created in OUTPUT_TP
Please observe that in the Iteration 5 ( page 50/148) the value of Dn=0
and note that the only difference with the previous Iterations is that this time skip=1 ( where previously it was always 0)
This is as close as I have seen anyone come to programming Mathcad like it was FORTRAN or BASIC.
You have a very long and complex calculation that could probably be easily be made more readable:
You created the function in Mathcad, but why the error log? (Yes, I know, error logs help you track where the problem is when programming.) Mathcad will turn an expression red or give another indication when an error is created--an instant, active error log.
Occasionally an iterative solution may be required. (I can't tell if this time is one of them.) But do you understand what solve blocks are and what they can do? Have you tried them?
There's a lot of capability here that you're not using.