Page 1 of 1

Find in string: @wfind

Posted: Tue Mar 05, 2013 8:29 am
by dagfinnrime
Hi,

I would like to search for a term in a string, and then do some actions. Example:

Code: Select all

%barclay_list = "AUD CAD" for %ccy AUD CAD CHF EUR if @wfind(%barclay_list,%ccy)>0 then fetch(d=Barclays) *_{%ccy} else fetch(d=wmreuters) *_{%ccy} endif next
This doesn't work. It never finds hit in the %barclay_list.

From an attempt with using @wkeep(%barclay_list,%ccy)=%ccy I learned that it doesn't really read the %barclay_list at all. Why?

When I do the following it works:

Code: Select all

@wfind("AUD CAD",%ccy)>0
Thanks in advance,
Dagfinn

Re: Find in string: @wfind

Posted: Tue Mar 05, 2013 8:51 am
by EViews Gareth
Looks like it works to me:

Code: Select all

create u 100 %barclay_list = "aud cad" table a !i=1 for %ccy aud cad chf eur if @wfind(%barclay_list, %ccy) > 0 then a(!i,1) = %ccy !i=!i+1 endif next

Re: Find in string: @wfind

Posted: Wed Mar 06, 2013 3:24 am
by dagfinnrime
Thanks, and so sorry for sloppiness on my behalf ...

I turned out that my string list was called "%barclay_list_". I have probably changed the name and didn't spot that underscore.