cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
SIBH
Level II

jsl script individually working fine, but add-in implementation is not working

I have a data table where I want to replace certain values with "."
Below is the script example

 

dt = Current Data Table();

for each row (
	if (:age == 12, age= . );
);

but same is not working when I have this code as add-in, data table looks like this

vinay	35
atul	55
prerna	12
adi	21

Thanks,

Sibh

2 REPLIES 2
ih
Super User (Alumni) ih
Super User (Alumni)

Re: jsl script individually working fine, but add-in implementation is not working

Edit: See @ErraticAttack's answer below, that is better.

 

Hi @SIBH,

 

Is it possible your current data table is not the one you want to manipulate.  In your script you are setting dt equal to the current data table, but you are not setting the data table equal to dt.   If dt is already defined somewhere, for example if you already used dt = Open( ... ), then you could set the current data table like this:

Current data table( dt );

Or, if dt references the right data table, you could scope your columns to be in that specific table, like this:

for each row (
	if (dt:age == 12, dt:age= . );
);

 

ErraticAttack
Level VI

Re: jsl script individually working fine, but add-in implementation is not working

It's best to be explicit with your table names, such as

 

For Each Row( dt,
    If( :age == 12,
:age = .
) )

The function "for each row" can take the table to loop over as the first argument.

Jordan