cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Dennisbur
Level IV

Begin Data Update

Hello

I have a table and would like the empty volume to be updated to 0

Dennisbur_0-1714999548377.png

I have written the script to update the column "19-04-2024"

the problem is the name of the column can be changed and I prefer to use column (3) or column (4)

but it doesn't work. 

can you please correct the script?

 

dt << Begin Data Update;
                                    dt << Recode Column (
                                    dt << Column (3),
                                   {Map Value( _rcOrig, {., 0}, Unmatched( _rcNow ) )},
                                   Update Properties( 1 ),
                                   Target Column(Column (3) ) );
dt << End Data Update;

12 REPLIES 12
hogi
Level XII

Re: Begin Data Update

 

dt = Open("$SAMPLE_DATA/Big Class.jmp"); 
dt << Recode Column( /*Print(.);*/AsColumn(dt, Print(1);2), Print(2);{Print(3);Map Value(_rcOrig, {12, Print(4);0}, Unmatched(_rcNow))}, /*Print(0);*/Update Properties(Print(5);1), /*Print(0);*/Target Column(/*Print(.);*/AsColumn(dt, Print(6);4)) );

gives

 

2
5
6
1
1
3
3
3
3
3
3
1
:height
  • Print(0):  no command expected here →  error message  → /* I put them into comments */
  • Print 2: 2nd argument gets evaluated; the list stays as it is (list don't get evaluated)
  • Print(5) & Print (6) →  arguments of the named arguments get evaluated
  • Print(1): now the first argument gets evaluated - why two times?
  • Print(3): 6 times (!) ( independent of values to replace )
  • Print(1): again ?

 

  • [Print(.): are evaluated, but prevent Jmp from correctly getting the Column infos → /* I put them into comments */]
  • Print(4): doesn't show up → not expected here → error  →  values are replaced by "." (instead of 0)
  • :height  : return value: target column 
hogi
Level XII

Re: Begin Data Update

(A) In 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt[1,"age"]=4;
row()=1;
AsColumn(dt, tmp=As Column(2);print(tmp);tmp /*=4*/); // column #4 , row #1= 59
Sum(As Column(2) ,7) // 4 + 7 = 11

The result of As Column(2)is not column #2, it's the value of column #2 (in row #1).

 

(B) On the other hand, the first argument of Recode Column( ) gets only evaluated to a level where As Column() returns the column reference

...  and NOT the value of the current row (like in the first example).

Same for the argument of the Target Column() argument.

 

@joseph_morgan talks in Using JSL to Develop Efficient, Robust Applications about Expressions which are "evaluated twice"
= (A)

 

if this "standard" is prevented (B), it feels like magic

hogi
Level XII

Re: Begin Data Update