Here is a modification to @jthi code that should handle this.
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(12),
Compress File When Saved(1),
New Column("E", Character, "Nominal", Set Values({"A", "B", "Disc", "Con", "A", "B", "C", "B", "Disc", "A", "B", "Con"})),
New Column("T", Numeric, "Continuous", Format("Best", 12), Set Values([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]))
);
dt << New Column("Dif", Numeric, Continuous, Formula(
If(Row() == 1,
last_disc = .;
retval = .;
);
If(:E == "Disc",
last_disc = :T;
retval = .;
firstCon = .;
, :E == "Con",
If(ismissing(firstcon), firstcon=:t);
retval = firstcon - last_disc
,
retval = .;
);
retval;
));
I suggest you take the time to read the Scripting Guide, available under JMP Help. Also please take the time to study the code provided by responding Discussion Forum members. The modifications to Jarmo's script did not require any new scripting knowledge. It only required some additional logic added to the flow of the script. It should be a user's goal to be able to make their own enhancements to the scripts
Jim