- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Conditional transformations
I have a somewhat strange need, though I think it might actually be possible to achieve even without JSL. What I want is to transform certain columns based on a column property, specifically text. "If column has the following text: XYZ, then carry out this formula, else do nothing." I know how to do "if/then" formulas but is there a scripting syntax to only modify columns with certain properties? I have many columns, or else I'd simply do it manually!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Conditional transformations
Here is the general structure of what you need to do....
names default to here(1);
dt=current data table();
colNames = dt << get column names(string);
for each({Name}, colNames,
if(contains(Name,"nox"),
for each row(
column(name)[row()] = ???????????; // your formula here
)
);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Conditional transformations
Could you please clarify your statement
"If column has the following text: XYZ, then carry out this formula, else do nothing."
Are you looking for XYZ being found in the column name, or in the any of the data values found in the column?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Conditional transformations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Conditional transformations
Here is the general structure of what you need to do....
names default to here(1);
dt=current data table();
colNames = dt << get column names(string);
for each({Name}, colNames,
if(contains(Name,"nox"),
for each row(
column(name)[row()] = ???????????; // your formula here
)
);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Conditional transformations
Perfect! Thanks so much. I knew this functionality must exist!