The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Replace function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

zknauss

USA
72 Posts

Posted - 09/26/2022 :  5:53:35 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello, I'm trying to get the following function to work so that in column 12 of my data set a value of "A" is replaced with "Active" and "B" with "inactive". I seem to have something wrong but am not getting any error messages to give guidence on what. Thanks!

ZTK


for (int i = 0; i <= wks.nrows; i++ ) {
range bb = [FreqSortNCON]"FRQSorting_N_CON"!$(12)[i]; if(bb=="A",Replace(bb,"Active");,if(bb=="B",Replace(bb,"Inactive");,"") }


ZTK

AmandaLu

439 Posts

Posted - 09/27/2022 :  04:18:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please try:

range bb = [FreqSortNCON]"FRQSorting_N_CON"!col(12);
for (ii = 1; ii <= wks.nrows; ii++ ) {
if(bb[ii]$ =="A") bb[ii]$ = "Active";
if(bb[ii]$ =="B") bb[ii]$ = "Inactive";
}

This is LabTalk document of looping and conditional:
https://www.originlab.com/doc/LabTalk/guide/Flow-of-Control
And “Replace” function is not used in this way:
https://www.originlab.com/doc/LabTalk/ref/Replace-func

Thanks,
Amanda
OriginLab Technical Service
Go to Top of Page

zknauss

USA
72 Posts

Posted - 09/27/2022 :  09:22:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That was perfect, Thank you!

ZTK
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000