Parameters in SQL and MMEX

Share your cool Custom SQL reports or Lua scripts with other mmex users

Parameters in SQL and MMEX

Postby rrodsal » Fri May 25, 2012 2:52 am

Hi there!

Is posible to use parameters in SQL and MMEX? Anybody can provide me a example?

I'm triying to amend some queries to ask about the year, the category, etc...I'm not able to do.

Thanks a lot

Regards

rrodsal
rrodsal
New MMEX User
 
Posts: 7
Joined: Fri Feb 24, 2012 5:41 am

Re: Parameters in SQL and MMEX

Postby Nikolay » Fri May 25, 2012 3:26 am

At the moment it is not possible.
Nikolay
MMEX Developer
 
Posts: 1173
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia

Re: Parameters in SQL and MMEX

Postby Nikolay » Tue Jan 08, 2013 10:29 am

And now we developing Lua scripting language interface. Now it possible!
For more information I've refer you to manual:
http://moneymanagerex.svn.sourceforge.n ... Extensions
Nikolay
MMEX Developer
 
Posts: 1173
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia

Re: Parameters in SQL and MMEX

Postby Renato » Tue Jan 08, 2013 1:47 pm

Hello Nikolay

can provide me a example?
regards Renato
Renato
Super MMEX User
 
Posts: 43
Joined: Mon Apr 25, 2011 1:36 pm

Re: Parameters in SQL and MMEX

Postby Nikolay » Tue Jan 08, 2013 2:43 pm

Code: Select all
-- Simple test script
------------------------------------------------------
function GetUserInfo()
   var = mmGetTextFromUser("What is your name?", "Lua Script",  "")
   return var
end
--
msg_1 = "Welcome to the world of " .. _VERSION .."<br> "
result = _"Hello "..GetUserInfo() .. "<br>".. msg_1
--
return result
--


Code: Select all
-- File: Test mmGetTableChoice
-------------------------------------------------------
   message = _("Select a month")
   heading = _("Lua: GetTableChoice")
   choice_array = {_("January"), _("February"), _("March"), _("April"), _("May "), _("June"),
        _("July"), _("August"), _("September"), _("October"), _("November"), _("December")}
  value = mmGetSingleChoice(message, heading, choice_array)
  return value


Code: Select all
sql_script_1 = "select payeeid, payeename from payee_v1"
sql_result, err = mmGetSQLResultSet(sql_script_1)
if err == 0 then
     choice, id = mmGetColumnChoice("1", "2",SQLResultSet, 2)
else
     choice = sql_result --Error description
     id = -1
end
return "Your choice: " .. choice .. " ID: " .. id
Nikolay
MMEX Developer
 
Posts: 1173
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia

Re: Parameters in SQL and MMEX

Postby Nikolay » Tue Jan 08, 2013 3:11 pm

Code: Select all
eol = '\n'
br = "<br>"
site = "http://download.finance.yahoo.com/d/quotes.csv?s=USDEUR=X&f=snd1l1t1"
    var_1 = mmGetSiteContent(site)

   site="http://download.finance.yahoo.com/d/quotes.csv?s=AZNRUB=X+HRKRUB=X+EURRUB=X+RUB=X+INRRUB=X+RUB=X+RUBRUB=X+UAHRUB=X+GBPRUB=X+USDRUB=X&f=sl1n&e=.csv"
    var = mmGetSiteContent(site)

var = var:gsub(eol, br)
return var..br..br..var_1
Nikolay
MMEX Developer
 
Posts: 1173
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia

Re: Parameters in SQL and MMEX

Postby Renato » Thu Jan 10, 2013 3:10 pm

Hello Nikolay

If I understand correctly, I could now use this selection:

Code: Select all
sql_script_1 = "select payeeid, payeename from payee_v1"
sql_result, err = mmGetSQLResultSet(sql_script_1)
if err == 0 then
     choice, id = mmGetColumnChoice("1", "2",SQLResultSet, 2)
else
     choice = sql_result --Error description
     id = -1
end
return "Your choice: " .. choice .. " ID: " .. id

to List all entries in the selected category.

Would it be possible to publish here, such a script (with entries and Total). ???

LUA: really for Beginners :http://lua.gts-stolberg.de/en/index.php
regards Renato
Renato
Super MMEX User
 
Posts: 43
Joined: Mon Apr 25, 2011 1:36 pm

Re: Parameters in SQL and MMEX

Postby Nikolay » Fri Jan 11, 2013 12:47 am

If something selected the data will be placed in Lua table (SQLResultSet).
Then you can do what you want in Lua side, then transform any data to html.
Nikolay
MMEX Developer
 
Posts: 1173
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia


Return to Custom SQL and Lua Scripts

Who is online

Users browsing this forum: jeqoxbjn, knttkfaw and 1 guest

cron