Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4254 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

That is an error in the recipe. It does what you tell it to do.

 

Return the (string) result of:

SMSetVariable ( "symbol" ; MyTable::stock_symbol )    /* =1 for success I guess */

& /*<- remember this symbol? It concatenates strings */

EvaluateGroovy ( "... 

 

What the author meant is most probably:

 

SMSetVariable ( "symbol" ; MyTable::stock_symbol ) AND EvaluateGroovy ( "... 

 

which does not work either because it simply returns the "1" which means the ANDed result of both operations (with the desired result of the stock quote being discarded).

 

So we have to play it a bit safer here and ask explicitly for the success of the SMSetVariable call:

 

 

If (    SMSetVariable ( "symbol" ; MyTable::stock_symbol ) ;
        EvaluateGroovy ( "String url = "http://download.finance.yahoo.com/d/quotes.csv?s=" + symbol + "&f=l1"; return new URL(url).getText().trim();" );
        "")
 

 

Or you could make it a ScripMaster module which would look like this:

 

post-105124-0-21131500-1365838801_thumb.

 

 

Remember: ScripMaster returns text. If you live in a region of the world where "," instead of "." is used, you'll have to substitute that yourself.

  • Like 1
Posted

Or use the more Groovy form with singe apostrophe inside the function which makes it easier to read in FM

 

If (    SMSetVariable ( "symbol" ; MyTable::stock_symbol ) ;
        EvaluateGroovy ( "url = 'http://download.finance.yahoo.com/d/quotes.csv?s=' + symbol + '&f=l1'; return new URL(url).getText().trim();" );
        "")

This topic is 4254 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.