Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Stock Tracker Snacks - Adds extra 1 at beginning

Featured Replies

Solved by Karsten Wolf

Go to solution
  • Solution

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.

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();" );
        "")
  • Author
  • Newbies

Thank you Karsten and John, your suggestions worked and are appreciated.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.