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
 All Forums
 Origin Forum
 Origin Forum
 Replace function

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
zknauss Posted - 09/26/2022 : 5:53:35 PM
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
2   L A T E S T    R E P L I E S    (Newest First)
zknauss Posted - 09/27/2022 : 09:22:05 AM
That was perfect, Thank you!

ZTK
AmandaLu Posted - 09/27/2022 : 04:18:17 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000