cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar

Finding the correct format of name jsl

HI!

I've made a jsl script which is the following one : 

For Each Row(
	dt_fichier3, 
// Lire la valeur de la colonne "Process" et les offsets
	process_value = :Process;
	first_offset = :first_OFFSET;
	second_offset = :second_OFFSET;
	third_offset = :third_OFFSET;

// Vérifier et assigner les valeurs des offsets si elles ne sont pas vides ou "."
	If(
		(Char(first_offset) != "." & Char(first_offset) != "") | (Char(second_offset) != "." &
		Char(second_offset) != "") | (Char(third_offset) != "." & Char(third_offset) != ""), 

// Créer une nouvelle colonne dans le fichier1 si elle n'existe pas encore
		new_column_name = process_value || "_offset";
		dt_fichier1 << New Column(new_column_name, Numeric, Continuous);



// Définir la formule pour la nouvelle colonne
		Column(dt_fichier1, new_column_name) << Set Formula(
			Eval(
				Eval Expr(
					If(:Supplier == "FIRST",
						:Expr(process_value) + Expr(:first_OFFSET),
						If(:Supplier == "SECOND",
							:Expr(:Process) + Expr(:second_OFFSET),
							If(
								:Supplier == "THIRD",
									:Expr(:Process) + Expr(:third_OFFSET),
								,
									:Expr(:Process) // Valeur par défaut si aucun fournisseur ne correspond
							)
						)
					)
				)
			)
		);
	);

);

Edit (2024-08-08 jthi): Added jsl formatting

 

the problem is that the formula doesn't work because the column name appeart in the column info->Formula as "Column_name" or it should be "Column-name"n, I trid to use Name() function but it did not work

10 REPLIES 10
jthi
Super User

Re: Finding the correct format of name jsl

Ah... Using :Process is correct in that location as you are using For Each Row loop. Still same method apply to convert those values you get from the columns back into columns

-Jarmo