- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Using loop variable as column input
Hello,
I am wondering if it possible to use my for loop variable, i, as an input for a new column, depending on the value of another column. Here is what I am thinking, but cannot get to work.
dt << New Column("Site", Numeric, Formula(
For(i = 1, i <= 8, i++,
If(Contains(:Column1, i), i);
)
));
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Using loop variable as column input
You certainly can. The only issue you have is that the Contains() function is a character handling function, and the arguments passed to it must be character(string) values. I am assuming :Column1 is a character column so all you need to do is to convert the index variable "i" from a numeric to character
dt << New Column("Site", Numeric, Formula(
For(i = 1, i <= 8, i++,
If(Contains(:Column1, char(i) ), i);
)
));
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Using loop variable as column input
What is it your a trying to do, do you have some example data?
Do you want to copy the value of Column1 to another column?
Do you want to take the value from another column based on the numeric reference in column1?