Problem with return value of stored function
Hi,
I've made a stored function that insert a new row in a table and return the primary key (see at the end of the message the function script).
In VS 2005 with Visual basic, using the designer, I've created a dataset containing a tableAdapter to be able to use the Pl/SQL function.
My problem is I can't get the proper return value. The VB code below works without error except that I get 0 as value.
What's wrong?
Cheers,
Sebastien
VB code
Dim myAddSession As New ICISDataSetTableAdapters.AddSessionTableAdapter
Dim intSessionId As Integer
intSessionId = myAddSession.ADD_SESSION(tbxUsername.Text, _
tempFolder.Substring(tempFolder.LastIndexOf("\") + 1), _
"toto", Environment.GetEnvironmentVariable("COMPUTERNAME"), _
myLevelAccess.icisUserId, myLevelAccess.levelId)
The debugger tells me that the ADD_SESSION function return value is Object.
add_session PL/SQL script:
CREATE OR REPLACE FUNCTION ICISSEC.add_session (
orausername IN icis_session.ora_user_name%TYPE,
ctxsessionid IN icis_session.ctx_session_id%TYPE,
ctxsessionname IN icis_session.ctx_session_name%TYPE,
ctxservername IN icis_session.ctx_server_name%TYPE,
icisuserid IN icis_session.icis_user_id%TYPE,
startlevelid IN icis_session.start_lvl_id%TYPE
RETURN icis_session.ICIS_SESSION_ID%TYPE
IS
tmpvar icis_session.ICIS_SESSION_ID%TYPE;
BEGIN
INSERT INTO icis_session
(ora_user_name, ctx_session_id, ctx_server_name,
icis_user_id, start_lvl_id, ctx_session_name
VALUES (orausername, ctxsessionid, ctxservername,
icisuserid, startlevelid, ctxsessionname
RETURNING icis_session_id
INTO tmpvar;
COMMIT;
RETURN tmpvar;
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END add_session;
naama wrote:
that if a value is null to convert it to 0 ? . i mean in the part of the declaration of parameter
Nope, can't do that in the signature. You'll need to handle that by validating the passed parameters at the start of the function.
It's simple enough. In your case you might just as well test for NULL and fail the function like this:
FUNCTION date_post_message(
user_lock_in IN NUMBER,
form_type_in IN NUMBER DEFAULT 0 ,
date_in IN DATE)
RETURN BOOLEAN
IS
v_num NUMBER(1);
BEGIN
dbms_output.put_line('Value of parameters : user_lock_in : '||user_lock_in || ' : form_type_in : '||form_type_in||' : date_in : '||date_in );
IF user_lock_in = 1 THEN
RETURN FALSE;
END IF;
IF form_type_in IS NULL THEN
RETURN FALSE;
ELSIF form_type_in NOT IN (1,2) THEN
RETURN FALSE;
END IF;
RETURN TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN FALSE;
END;In other use cases I would declare a local variable and process it like this:
IF form_type_in IS NULL THEN
l_form_type := 0;
ELSE
l_form_type := form_type_in;
END IF;Obviously the code should use the local variable rather than the parameter.
Validating the values passed in parameters at the start of a function is good practice. If you really want to go to town, read about Design By Contract.
Cheers, APC
Edited by: APC on Nov 9, 2011 1:36 PM
Added example, as requested by OP
Similar Messages
-
ADF Code Corner 069 : problem with returned value
Hello,
I use jdeveloper 11.1.2.2.0 and am trying to follow the sample 69 from ADF Code Croner : how-to create a custom LOV using bounded task flows. http://www.oracle.com/technetwork/developer-tools/adf/learnmore/69-custom-lov-with-btf-276178.pdf
I have a problem with the returned value. The correct value is returned in the inputText but it seems that it is just at UI level and that binding layer is not impacted. If user click on next button, all others rows show the same value in the inputText (the value chosen before in the lov), and not the correct value which must be value from db.
How can I solve this problem?
note : opening the 69-sample, jdeveloper ask me to migrate some files (jpr/jws) from previous version of jdeveloper.
Edited by: h0s on 8 oct. 2012 06:14Yes It happens with the downloaded sample. You can do this test :
Launch EmployeesForm activity -> Open the LOV and select a department -> click next and see that the department id is the same for all rows.
jdeveloper 11.1.2.2.0 -
Problem loading images from a return value of a function
hello, I write because I uin problem in loading images from a return value of a function.
I created a database with a field "image" of type string, where I put the physical address of the image. I have written like this: {__DIR__ }foto.jpg
Place the code, so you understand better
function imageViewImage(): javafx.scene.image.Image {
connetti();
lass.forName(driverName);
con = DriverManager.getConnection(url,user,"");
stmt = con.createStatement();
var richiesta:String = "SELECT image from viaggio WHERE id_viaggio=7";
rs1 = stmt.executeQuery(richiesta);
var result :String;
rs1.next();
risultato = rs1.getString("image");
JOptionPane.showMessageDialog(null, result);
var imagez = Image{
url:"{result}";
return imagez;
The image is in the source code package
First I connect to the database, run the query and I take the contents of the image.
Can anyone help me?
Is right to put in the database {__DIR__} foto.jpg or do I put only foto.jpg?Hello unkus_nob,
I would rather suggest you to save only filename of that image like "foto.jpg" in database. And just concat it with the String variable containing "{__DIR__}".
Actually the javafx compiler converts the {__DIR__} to the existing class directory path something like : "jar:file:/..../".
var currentDir ="{__DIR__}";
risultato = "{currentDir}{rs1.getString("immagine"})";
var image = Image{
url:risultato
return image;--NARAYAN G. -
Getting Return values from RFC function call with visual basic
Hi,
I am creating a sample app to connect to a SAP system which call its RFC functions created with ABAP. It was known that the function will return more than 1 return values.
SAP Function name ==> "ZFMTP_RFC_GET_RESULT"
Export parameters (to SAP):
- Student Name [char 10] ==> "STUNAME"
- Student ID [char 20] ==> "STUID"
Return values (From SAP):
- Results [char 10] ==> "RESULT"
- Remarks [char 200] ==> "REMARKS"
i have managed to get sample codes for connecting and call a RFC function with vb but they only get a return value. How do i retrieve multiple return values like the above function "RESULT" and "REMARKS"?
Here's my vb code to accessing the function
Dim R3 As Object
Dim FBFunc As Object
Dim returnFunc As Boolean
Dim connected As Boolean
R3 = CreateObject("SAP.Functions")
R3.Connection.Client = "000"
R3.Connection.User = "BCUSER"
R3.Connection.Password = "minisap"
R3.Connection.Language = "DE"
R3.Connection.System = "dtsystem"
R3.Connection.Applicationserver = "xxx.xxx.xxx.xxx"
connected = R3.Connection.Logon(0, True)
If connected <> True Then
MsgBox("Unable to connect to SAP")
End If
FBFunc = R3.add("ZFMTP_RFC_GET_RESULT")
FBFunc.exports("STUNAME") = "Jonny"
FBFunc.exports("STUID") = "12345"
returnFunc = FBFunc.Call() <<== How do i get the return value? or RESULT and REMARKS of the RFC Function?
thanks alot.
Edited by: Eugene Tan on Mar 4, 2008 7:17 AMHi Gregor,
Thanks for the link....i am having some doubts with the codes, hope you can clarify them for me if you know the codes..
Below is the code snippet.
Set impReturn = CHPASS_FN.Imports("RETURN") <<=== is RETURN the standard keyword to get a return object?
expPassword.Value = currpass
expNewPass.Value = newpass
expFillRet.Value = "1"
''' Call change password function
If CHPASS_FN.Call = True Then
outFile.Write (", Called Function")
Message = impReturn("MESSAGE") <<==== So if i have 3 return values..i just replace with the return value variable names?
outFile.WriteLine " : " & Message
Else
outFile.Write (", Call to function failed")
End If
thanks alot...all your help is very appreciated. -
How to call a dialog program with return value in another dialog program
Dear All,
How can I call a dialog program with return value from another dialog program?
Regards,
Alok.Hi Alok,
You can you SET/GET parameters to do this.
This is some information about this.
To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETERstatements.
To fill one, use:
SET PARAMETER ID pid FIELD f.
This statement saves the contents of field f under the ID pid in the SAP memory. The ID pid can be up to 20 characters long. If there was already a value stored under pid, this statement overwrites it. If you double-click pid in the ABAP Editor, parameters that do not exist can be created as a Repository object.
To read an SPA/GPA parameter, use:
GET PARAMETER ID pid FIELD f.
This statement places the value stored under the pid ID into the variable f. If the system does not find any value for pid in the SAP memory, sy-subrc is set to 4. Otherwise, it sets the value to 0.
Thanks,
SriRatna -
Chart - problem with realize one of the function under CR XI
Post Author: mrowa
CA Forum: Charts and Graphs
Hello,
I have
problem with realize one of the function under CR XI. I would be persuade if
any of us would like to help me.
1)
1) From
database (basically from one table), I take data to make report. Each of record
have appropriate fields:
dteData
intYear
intMonth
intDate
2)
2) I
want to realized comparison data from two or more periods of time on one chart
and in one table. For easily explanation I will describe problem on two
periods.For instance, user want to display and compare
on chart date (type monthly -sum data of each month) from 2007.02 u2013 2007.05
with date from 2006.03 u2013 2006.06. So we compare month 2007.02 with 2006.03;
2007.03 with 2006.04; 2007.04 with 2006.05; 2007.05 with 2006.06
On char I would like to display bars with comparison
of months.
Problem is that I donu2019t know how to write
something similar. I can use one period without any problems, but two and mores
I canu2019t realized.
Detail description:
I passed
two parameters two report:
{?from}, {?to} u2013for first period
{?offset}, it means {?from}+{?offset},
{?to}+{?offset} - for second period
On axis Y I have Sum(intDate);On
X (year + month). But on each value x( example 20007.02) I need to have
two values (bars). Value for standard period and offset.
For example for x=2007.02, I need
two bars one equal 2007.02 and second with offset u2013 2006.03
Movement to next value (bar) is
persuade by fields {data.rok}&{data.month} first or second period. This is
combination of two elements year&month defined under Formula. Problem
persist in that both period has different year.month and here problem starts once
again. I donu2019t know how to solve it. I have found out one solution but it
limits user only for two periods (I want to compare more).
My idea for compare only two
periods:
I make one query in CR for one
period and second query for second period.
Firs query:
"SELECT
year ,
month
Second query
"SELECT
year + FLOOR({month + offset} % 13),
{month + offset} % 13
Then in CR I connect two periods and
make u201Ctableu201D (results of queries) with JOIN on fields year and month.
This solution is not functional,
because I need to make reports for days and hours as well. In this solution I
canu2019t use (%31), because not all months has 31 days.
I use CR in WEB app made in Visual
Studio 2005. Maybe from aspx we can manipulate with date to get exact solution,
and solve problem with SELECT.
Hope my description clearly
describe problem and someone will be able to help me. I would be thankful.I have had similar problem before.
Because I had too many data, the legend would not display all the data. Also the chart would not display all the data. But I was able to find a work around.
In your case, Right click on the Legend text and click on Format Legend Entry.
Change the font of the legend to 4 (which is the minimum). This may work.
If you are also having problem with data labels, you could change the font size of the data labels.
Hope this helps.
Thank you. -
Problem with calling a oracle stored procedure
Hi,
I am using the following callable statement to invoke a oracle stored procedure/function.
String myCallableStmt="{?=call IB_DDL.CREATE_DATASET(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
But I am getting the following errors which do not make sense to me
Exception in thread "main" java.lang.NullPointerException
at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java:870)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:956)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1159)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3284)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3389)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4222)
at org.jtdemo.CreateDataSet.callCreateDatasetProcedure(CreateDataSet.java:246)
at org.jtdemo.Main.main(Main.java:29)
Can anyone help me here.
Thanks in advance
KalyanMay be I have used the word "procedure" loosely. Its infact a oracle function which returns a message of type Varchar2. Hence "{?=.....} here is used for registering the return value from the function. The remaining statement CREATE_DATASET(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), here the first 14 are input parameters whereas the last one is the OUT parameter of the function. Hope this helps. Anways I am pasting my code below...
CallableStatement cstmt = null;
String myCallableStmt="{?=call IB_DDL.CREATE_DATASET(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
try {
System.out.print("Creating DataSet.......\n");
cstmt = targetCon.prepareCall(myCallableStmt);
cstmt.setObject("USER_ID_IN",this.USER_ID_IN);
cstmt.setObject("TABLE_NAME_IN",this.TABLE_NAME_IN);
cstmt.setObject("LAYOUT_IN",this.layoutCollection);
cstmt.setObject("DATA_TABLESPACE_IN",this.DATA_TABLESPACE_IN);
cstmt.setObject("INDEX_TABLESPACE_IN",this.INDEX_TABLESPACE_IN);
cstmt.setObject("STRING_POOL_NAME_IN",this.STRING_POOL_NAME_IN);
cstmt.setObject("NUMBER_POOL_NAME_IN",this.NUMBER_POOL_NAME_IN);
cstmt.setObject("DATE_POOL_NAME_IN",this.DATE_POOL_NAME_IN);
cstmt.setObject("LINK_POOL_NAME_IN",this.LINK_POOL_NAME_IN);
cstmt.setObject("DATASET_LEVEL_CONSTR_TYPE",this.DATASET_LEVEL_CONSTR_TYPE);
cstmt.setObject("DATASET_LEVEL_CONSTR_BODY",this.DATASET_LEVEL_CONSTR_BODY);
cstmt.setObject("POOLING_IN",this.POOLING_IN);
cstmt.setObject("SEGMENTATION_IN",this.SEGMENTATION_IN);
cstmt.setObject("DATASET_PARTITIONING_IN",this.DATASET_PARTITIONING_IN);
cstmt.registerOutParameter("DATASET_ID_OUT",OracleTypes.INTEGER);
cstmt.registerOutParameter("RETURN_MESSAGE",OracleTypes.VARCHAR);
cstmt.execute();
String returnMessage = (String)cstmt.getObject("RETURN_MESSAGE");
System.out.print(returnMessage);
}catch(SQLException e) {
e.printStackTrace();
} -
Hi Experts,
I have a problem with offset values. I have create a variable on OFISCPER, it's characteristic value, indivdual value, mandatory and ready for the input. I need to show the varibel period and the l previous period and so on till 12 periods. I used the offset values (-1, -2, etc.) but when I execute the query I can show just the variable period and the period previous I don`t see. The query is based on multiprovider and don´t has filters. Can anyone help me?Leonel,
You may nt need to have 12 columns in the query designer.
You could include the keyfigure and restrict it to the variable and create the offset for the 12 periods
Check this http://help.sap.com/saphelp_nw04/helpdata/en/00/e8d13f7fb44c21e10000000a1550b0/frameset.htm
-Doodle -
After upgraded ios6 i got problem with whatapp. "last seen" function is not working
HI eveyone
after upgraded ios6 i got problem with whatapp. "last seen" function is not working .. it's doest show last seen who enter the chat . is anyone have the same problem .. i even restore and reinstall to my ph but it's not work .. if someone know how to fix it, plz tell me how to do .. thanksAlso, when I check this post several times a day, I always see warning 'Connection is untrust'. If I close browser and reopen immediately everything is ok.
-
Problem with the MVMapView.print(printMapDiv,) function.
Hello,
I have a problem with the MVMapView.print(printMapDiv,) function.
My FOIs are displayed correct on the screen but on the printed letter
the stroke(border) color and the labels of a circle are not displayed.
the fois have a custom style:
var xmlDef = '<svg width="1in" height="1in">'+
'<g class="marker" '+
'style="width:40;height:40;stroke:0xff0000;fill:0x00ff00;stroke-width:1.5">'+
'<circle r="20"/>'+
'</g>'+
'</svg>';
markerStyle = new MVXMLStyle("my_vector_icon_" + i + '_' + j, xmlDef)
and are created like this:
v_result = new MVFOI(p_geofeature.foiId, p_geofeature.foiGeomertyObject, markerStyle, null, 30, 30);
v_result.setHTMLElement('1',0,0);
Browser: I can see the map with a green circle, a red border and '1' as a label on
top of the Circle.
Printed Letter: I see the map with the green circle but no red border Color and no label.
The implmentation of the printing function uses the same techique like the "Oracle Maps Tutorial"
It is a javascript function called through a href link:
function mapPrint()
var a=document.getElementById("printmap");
global_gdi.mapviewer.mapview.print(a);
Version is Ver11_1_1_5_B110527
Does anbody know how to print the map properly including the contents of the
MVFOI class set trough setHTMLElement function?
Greetings
AndreThanks for your reply but it is not working and i can prove that.
I have a small example based on the mapviewer print tutorial. To run it you need a
mapviewer installation and copy the text into a html file. In the browser you can see
a green point with a red border and red label text on a map.
If you use the print button everything except the label text will be printed.
I think this is a mapviewer css-api bug.
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@media screen
.noscreen {display: none;}
@media print
.noprint{display: none;}
</style>
<script language="Javascript" src="/mapviewer/fsmc/jslib/oraclemaps.js"></script>
<script language=javascript>
var mapview;
var baseURL = "http://"+document.location.host+"/mapviewer";
function showMap()
mapview = new MVMapView(document.getElementById("map"), baseURL);
mapview.addMapTileLayer(new MVMapTileLayer("mvdemo.demo_map"));
mapview.setCenter(MVSdoGeometry.createPoint(-122.45, 37.6706,8307));
mapview.setZoomLevel(4);
mapview.display();
//adds custom foi with label
var xmlDef = '<svg width="1in" height="1in">'+
'<g class="marker" '+
'style="width:40;height:40;font-family:sans-serif;font-size:20pt;stroke:0xff0000;fill:0x00ff00;stroke-width:1.5">'+
'<circle r="20"/>'+
'</g>'+
'</svg>';
var markerStyle = new MVXMLStyle("my_vector_icon_", xmlDef);
mpoint = MVSdoGeometry.createPoint(-122.30, 37.73,8307);
var v_result = new MVFOI("11", mpoint, markerStyle, null, 60, 60);
v_result.setHTMLElement('test label',0,0);
mapview.addFOI(v_result);
function mapPrint()
var a=document.getElementById("printmap");
mapview.print(a);
</script>
</head>
<body onload=javascript:showMap()>
<div id="map" style="position:absolute;top:50px; left:10px; width:600px; height:450px;border:0px"></div>
<div id="printmap" class="noscreen"></div>
<p>Please click <a href="javascript:mapPrint()">here</a> to print map</p>
</body>
</html>
Edited by: user12005064 on 27.02.2012 02:37 -
LOV Problem with multiple values
HI All,
I have a problem with LOV .When ever i click LOV after search button all values are displaying fine.
But when i get so many values i want to select only one vlaue that is not cmng to the main page ....Cursor is in running state always after that time out error is coming in my application .
This problem is coming with with only single value selection in lOV only problem with Multiple values retrival that time only...
(Iam using 11.1.1.3 Jdeveloper.)
Thanx in advance...duplicate of {thread:id=2286814}
-
I am having problems with copy and then paste function
Within the past month, I noticed that I am having a problem with my copy and paste function on my IMAC. I have an intel based IMAC with the Mac OS 10.5.8 running. Is there anyone experiencing this problem? Any assistance, recommendations?
Then try a SMC reset:
Resetting the SMC (System Management Controller) on Intel-based Macs:
http://support.apple.com/kb/ht3964 and
http://support.apple.com/kb/HT1237?viewlocale=en_US
Resetting your Mac's PRAM and NVRAM:
http://support.apple.com/kb/ht1379 -
Problems with PL/SQL Calling Java Function that returns String []
Hi,
I have written the following code. It's not compiling OK.
DECLARE
TYPE Tokens_Type IS VARYING ARRAY(20) OF VARCHAR2(20);
s1 Tokens_Type DEFAULT NULL;
SQL_STR VARCHAR2(2000) DEFAULT NULL;
BEGIN
SQL_STR := 'CREATE OR REPLACE FUNCTION Schema1.SPLIT_STR (S2 VARCHAR2(20)) ' ||
'RETURN s1 ' ||
'AS LANGUAGE JAVA ' ||
'NAME ''String_Mani.split_it (String) return java.lang.String []''';
EXECUTE IMMEDIATE SQL_STR;
END;
What's the problem with this?You cannot create a function with a locally defined return type. As soon as this script is executed, Oracle no longer knows what the TOKEN_TYPE type is any more, so the function will be invalid.
You need to use a collection type defined at the database level or defined in a package - somewhere where it will persist. -
Trouble referencing return values of a Function in Stored Procedure
Hello all,
I have the following Function and Stored Procedure (simplified for this post). The error I am getting is in the SELECT, WHERE clause of the UPDATE command. My function is returning a sys_refcursor and I am trying to reference column names but keep getting the error
ORA-00904: "PUBLISHEDDOCVERSIONID": invalid identifier
What am I doing wrong?
Function
CREATE OR REPLACE FUNCTION &HKDB_Schema_Name..QueryKnowdeDocVersion(aKGID int)
RETURN sys_refcursor
IS
aCur sys_refcursor;
BEGIN
OPEN aCur FOR
SELECT pkd.KnowdeID as "PublishedKnowdeID", pkd.DocumentID as "PublishedDocID", pkd.VersionID as "PublishedDocVersionID"
FROM KnowdeDocument pkd
WHERE pkd.KGID = aKGID;
RETURN aCur;
END;Stored Procedure
UPDATE KnowdeDocument
SET DocumentID = (SELECT PublishedDocID FROM (SELECT QueryKnowdeDocVersion(aKGID, aPublishedKGID, aTextVersionID) FROM DUAL)
WHERE PublishedKnowdeID = KnowdeDocument.KnowdeID
AND PublishedDocID = KnowdeDocument.DocumentID
AND ((PublishedDocVersionID is NULL and KnowdeDocument.VersionID is NULL) OR (PublishedDocVersionID is not NULL AND
PublishedDocVersionID = KnowdeDocument.VersionID)))Regards,
TobyHi redeye,
Your select is from:
(select queryknowdedocversion(akgid
,apublishedkgid
,atextversionid)
from dual)This has no publisheddocversionid. Unfortunately I cannot figure out what you are trying to do with that ref_cursor.
Edit:
Or perhaps publisheddocversionid is a column in KnowdeDocument? Could this be case sensitive as well? (Bad idea to use quotations when naming things)
Regards
Peter
Edited by: Peter on Aug 24, 2009 3:39 AM -
Problem with checkbox value and app.settings.getSetting()
Hello everyone.
I`ve got a problem with getting saved settings for checkbox.
Saved settings doesn`t apply on checkbox value.
It`s strange, but it always "true".
So here piece of code:
checkMe = 11; //any value for the first time running
if (app.settings.haveSetting("savea", "chck")) {
checkMe = app.settings.getSetting("savea", "chck"); // get saved value, else 11
alert("checkMe = "+checkMe)
if(checkMe == 11){
checkMe= false; //if there is no saved settings, checkbox value will be false/ unchecked
alert("You run this script first time, so manual value will be 'false'")
}else{
checkMe = app.settings.getSetting("savea", "chck"); // if saved settings exist, get true or false
alert("Yes, checkMe will = "+checkMe)
win.checkPanel.chkOne.value = checkMe; /// checkbox value will equal saved checkMe
var fff = win.checkPanel.chkOne.value; // string for alert
alert("aha! but checkbox value is = " +fff+ "\n Why so?") // here we`ve got always "true"
win.checkPanel.chkOne.onClick = function () {
var path11 = win.checkPanel.chkOne.value; // checkbox value to variable
app.settings.saveSetting("savea", "chck", path11); //saving checkbox value
alert("Saved this value - " + app.settings.getSetting("savea", "chck"))
win.checkPanel.chkOne.value is always true.
Can someone exmplain why and how to get rid of this static value?
P.S. just in case, here is full code:
function mainFun()
this.windowRef = null;
mainFun.prototype.run = function()
/*----- UI -----*/
var retval = true;
var win = new Window("palette", "Check option", [150, 150, 460, 455]);
this.windowRef = win;
win.checkPanel = win.add("panel", [25, 150, 285, 265], "Checkbox");
win.checkPanel.chkOne = win.checkPanel.add("checkbox", [10, 15, 125, 35], "Checkbox One");
//win.checkPanel.chkTxtOne = win.checkPanel.add('edittext', [140, 15, 230, 35], '');
win.quitBtn = win.add("button", [110,275,200,295], "Close");
checkMe = 11; //any value for the first time running
if (app.settings.haveSetting("savea", "chck")) {
checkMe = app.settings.getSetting("savea", "chck"); // get saved value, else 11
alert("checkMe = "+checkMe)
if(checkMe == 11){
checkMe= false; //if there is no saved settings, checkbox value will be false/ unchecked
alert("You run this script first time, so manual value will be 'false'")
}else{
checkMe = app.settings.getSetting("savea", "chck"); // if saved settings exist, get true or false
alert("Yes, checkMe will = "+checkMe)
win.checkPanel.chkOne.value = checkMe; /// checkbox value will equal saved checkMe
var fff = win.checkPanel.chkOne.value; // string for alert
alert("aha! but checkbox value is = " +fff+ "\n Why so?") // here we`ve got always "true"
win.checkPanel.chkOne.onClick = function () {
var path11 = win.checkPanel.chkOne.value; // checkbox value to variable
app.settings.saveSetting("savea", "chck", path11); //saving checkbox value
alert("Saved this value - " + app.settings.getSetting("savea", "chck"))
win.quitBtn.onClick = function() {
win.close();
win.center();
win.show();
return retval;
if(typeof(mainFun_unitTest) == "undefined") {
new mainFun().run();Played around with different values, combinations...
Doesn`t work too:
checkMe = 111; //any value for the first time running
if (app.settings.haveSetting("333", "check")) {
checkMe = app.settings.getSetting("333", "check");
alert(checkMe);
if(checkMe == 111){
win.checkPanel.chkOne.value= false;
}else{
if (checkMe != false){
win.checkPanel.chkOne.value= true;
}else{
win.checkPanel.chkOne.value= false;
win.checkPanel.chkOne.onClick = function () {
var path11 = win.checkPanel.chkOne.value;
var path12 = path11.toString();
app.settings.saveSetting("333", "check", path12);
alert("Saved value - " + app.settings.getSetting("333", "check"))
Maybe you are looking for
-
Acrobat X standard problem Verdana-Italic font
when opening a pdf from a reliable source using acrobat_x standard a message comes up that it can't find Verdana-Italic font and doesn't display most of the document. However if I open the same pdf with Adobe reader XI it has no problem. any sugge
-
Unexpected element name - confusion of types in client
I have a web service definition that performs four operations: - String getTitle(long) - returns a title for a single asset - StringArrayType) getTitles(LongArrayType) - returns an ordered list of titles matching input list - AssetSummaryType getSumm
-
To buy a 24" iMac or not?
I am considering purchasing a 24" iMac. If the screens are as bad as everyone says, should I just bag it and wait awhile? Right now I have a mini and need more horsepower for iMovie, iPhoto, etc. Any suggestions?
-
Discount calculated incorrectly - Need help
Hi, We are facing a unusual issue in pricing . We have a volume discount condition type configued and the following Base scale assigned . Scale UOM is EA. 0.000 1.000- % 5.000 2.000- % 10.000 3.000- %
-
Problems with Sound in Quicktime Pro
Im having problems with my Quicktime Pro. Basically whenever i open up a movie file using Quicktime (.mov, .avi, .mpg, etc) the video will play but the audio jumps and sounds like B B B B B, K K K K, D D D D. It does this even if i open a Quicktime M