tag:blogger.com,1999:blog-4968667725127637904.post8290080830857544987..comments2024-03-21T05:38:29.299-07:00Comments on fishing with FDMEE: Code Snippet: looping a ResultSet returned by API functionFrancisco Amores (@akafdmee)http://www.blogger.com/profile/06055076603713050868noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4968667725127637904.post-21743911984180986712017-10-11T07:51:13.552-07:002017-10-11T07:51:13.552-07:00script is not correct.
catKey = rs.getString(&quo...script is not correct.<br /><br />catKey = rs.getString("CATKEY")<br />c.close()<br /><br />if (strCatKey == catKey and StrPerKey[0:3] == "Giu" or strCatKey== catKey and StrPerKey[0:3] == "Dic"):<br />Francisco Amores (@akafdmee)https://www.blogger.com/profile/06055076603713050868noreply@blogger.comtag:blogger.com,1999:blog-4968667725127637904.post-38305783249055431712017-08-30T02:24:11.589-07:002017-08-30T02:24:11.589-07:00Dear Francisco, we are trying to develop an SQL qu...Dear Francisco, we are trying to develop an SQL query from within the jython script of a logic acocunt function. This is in order to avoid adapting the scripts we developed whenever we move them into production, as the CATKEY assumes different values on these two environments. Hereunder is our attempt (not working, error: name 'CATKEY' is not defined):<br /><br />import java.sql as jsql<br />import java.lang as lang<br /><br />driver, url, user, passwd = ("oracle.jdbc.driver.OracleDriver","jdbc:oracle:thin:@epmtps2db.gruppofs.it:1521/EPMT","marino","marino")<br />lang.Class.forName(driver)<br />c = jsql.DriverManager.getConnection(url,user,passwd)<br />s = c.createStatement()<br />sql_stmt = "select CATKEY from FDMEEPS2.TPOVCATEGORY where CATNAME = 'CONS_IAS'"<br />print "executing " , sql_stmt<br />rs = s.executeQuery(sql_stmt)<br />while (rs.next()):<br /> print rs.getString("CATKEY")<br />c.close()<br /><br />if (strCatKey == CATKEY and StrPerKey[0:3] == "Giu" or strCatKey== CATKEY and StrPerKey[0:3] == "Dic"):<br /> RESULT = CURVAL <br />else:<br /> RESULT = "Skip"<br /><br />Any suggestion or hint wold be much appreciated!!Angelohttps://www.blogger.com/profile/07131478617335895729noreply@blogger.com