- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to remove blank spaces from a List in JSL ?
Hello all ,
I am new to JMP Scripting . I was working on something and was trying to delete empty spaces from a list in JMP . I have done the following in order to do that :
for(i=1,i<nrows(dt),i++,
if(SampleList(i)== "",
//then
Remove From(SampleList,i,1);
//else
,
ShowSampleList);
);
);
Uday
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to remove blank spaces from a List in JSL ?
O I misunderstood. Looks like you're not after "blank spaces" but empty values. Change " " into ""
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to remove blank spaces from a List in JSL ?
Just to clarify , I used Show(SampleList). I was trying to edit it when the post went through. I am not receiving an error, but there are no changes being made to the list either despite the fact that it has empty spaces .
Regards
Uday
Uday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to remove blank spaces from a List in JSL ?
In JSL, square brackets are used for list subscripts. Also, when using Remove from() it's usually better to loop from the end of the list (or any consecutive spaces will not be removed as intended).
SampleList = {" ", " ", "B", "C", " ", "A", "B", "C", " "};
For( i = N Items( samplelist ), i > 0, i--,
If( SampleList[i] == " ",
//then
Remove From( SampleList, i, 1 );
//else
,
Show( SampleList )
)
);
Show( SampleList );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to remove blank spaces from a List in JSL ?
Hello MS ,
for(i=N items(IrradianceSensorIds),i>0,i--,
if(IrradianceSensorIds == " ",
Remove From(IrradianceSensorIds,i,1);
,
Show(IrradianceSensorIds)
)
);
Show(IrradianceSensorIds);
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
IrradianceSensorIds = {"SH01 Radiation", "SH02 Radiation", "SH03 Radiation", "SH04 Radiation", "SH05 Radiation", "", "", ""};
There is no change in the result even if I use the square brackets . Here is the actual snippet and the result from the Log
Uday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to remove blank spaces from a List in JSL ?
O I misunderstood. Looks like you're not after "blank spaces" but empty values. Change " " into ""