- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
enter value in specific cell
Hello,
new little problem.
I would like to enter a value in a specific cell by
1) row name
2) column name
for example
I would like to enter value 25 in cell
row (from col1) = 4
col = SYN
Col1 | SYN | MIS |
---|---|---|
1 | 10 | |
2 | 15 | |
3 | 20 | |
4 | ||
5 | ||
6 | ||
7 | ||
8 |
best regards
Lionel
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
Hi llupo0,
What are you trying to accomplish with your script? I think this may be closer to what you are trying to do.
dt = New Table( "Little Class",
Add Rows( 3 ),
New Column( "name", Character, "Nominal", Set Values( {"KATIE", "LOUISE", "JANE"} ) ),
New Column( "height", "Continuous", Set Values( [59, 61, 55] ) ),
New Column( "weight", "Continuous", Set Values( [100, 150, 200] ) )
);
column_name = dt << get column names();
my_list = {62, 151};
For( i = 2, i <= N Items( column_name ), i++, // Add < sign.
r = dt << Get Rows Where( :name == "LOUISE" );
Column( i )[r] = my_list[i - 1]; // my_list has only two values, thus index [i - 1] is used for i = 3.
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
Hi llupo0,
Try this:
// Create example table.
dt = New Table( "Little Class",
Add Rows( 3 ),
New Column( "name", Character, "Nominal", Set Values( {"KATIE", "LOUISE", "JANE"} ) ),
New Column( "height", "Continuous", Set Values( [59, 61, 55] ) )
);
// Update value from row number.
dt:height[2] = 62;
// Update value from column value.
r = dt << Get Rows Where( :name == "LOUISE" );
dt:height[r] = 63;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
Morning Robot
thank you for your feedback.
I see how you addressed the row. So in the same way I can also with a for loop have column movement.
tried but doesnt work :-(
dt = New Table( "Little Class",
Add Rows( 3 ),
New Column( "name", Character, "Nominal", Set Values( {"KATIE", "LOUISE", "JANE"} ) ),
New Column( "height", "Continuous", Set Values( [59, 61, 55] ) ),
New Column( "weight", "Continuous", Set Values( [100, 150, 200] ) ),
);
column_name = dt << get column names();
//my_list = {10, 20};
my_list = 777;
for(i=2, i=3, i++,
r = dt << Get Rows Where( :name == "LOUISE" );
dt:column_name= my_list
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
Hi llupo0,
What are you trying to accomplish with your script? I think this may be closer to what you are trying to do.
dt = New Table( "Little Class",
Add Rows( 3 ),
New Column( "name", Character, "Nominal", Set Values( {"KATIE", "LOUISE", "JANE"} ) ),
New Column( "height", "Continuous", Set Values( [59, 61, 55] ) ),
New Column( "weight", "Continuous", Set Values( [100, 150, 200] ) )
);
column_name = dt << get column names();
my_list = {62, 151};
For( i = 2, i <= N Items( column_name ), i++, // Add < sign.
r = dt << Get Rows Where( :name == "LOUISE" );
Column( i )[r] = my_list[i - 1]; // my_list has only two values, thus index [i - 1] is used for i = 3.
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
trying to fill in value for certain column by row where row represents working weeks
so kind of weekly update record table.
ok it works! thank you. Also it is a good learning for me on how to manipulate table and data :-)
BTW,
how do you do to copy JSL code keeping color just like in JMP?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
>> BTW,
>> how do you do to copy JSL code keeping color just like in JMP?
Copy/paste the code from the JSL script editor into MS-Word.
Copy/paste the code from MS-Word to this forum.
// JSL Script
a = {"Hello", "World"};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
It doesn't have to be word. Any text editor that supports formatting, for example, I often copy and paste it into an email message since I always have Outlook open, but rarely have Word open.
Also here is how you would get your code working: (Just an example in debugging)
First, i=3 isn't a Boolean, if you meant i==3, this would never evaluate to true since i=2. So I made the assumption you meant i<=3.
Next, you change my_list from a list to a number, so you need to reflect that in the for loop. my_list becomes my_list.
Lastly, you need to be aware of the order of operations. dt:column_name
column_name = dt << get column names();
//my_list = {10, 20};
my_list = 555;
for(i=2, i<=3, i++,
r = dt << Get Rows Where( :name == "LOUISE" );
dt:(column_name[i])[r] = my_list;
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
thank you very for your time explaining me my mistakes.
Learning from it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
Looking for help to assign list values to a cell.
I have a list obtained by using associative arrays on a column.
The number of values in the list is not known beforehand.Need to assign all values in the list to one specific cell.
So far I have tried this -
unique_vals = {};
unique_vals = Associative Array(dt:Test_Values) << Get Keys;
Column(dtout,"Col")[31] = unique vals;
But getting an error as follows -
Column "Col" requires character values{1} in access or evaluation of 'Bad Argument'
If I use Column(dtout,"Col")[31] = unique vals[1];the error goes away but I need to assign all items in the list to that cell.
Any help appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: enter value in specific cell
A JMP List is not one of the elements that can be defined for a data type for a column. However, you can save the list as a character string, and write it to a character column. Also, I believe that all you need to do to make your script work, is to use the Char() function to change the result from << get keys into a string
unique_vals = {};
unique_vals = Associative Array(dt:Test_Values) << Get Keys;
Column(dtout,"Col")[31] = Char( unique vals );