Thread run() resets value of variables! WHY!

Hello.. i am having a VERY frustrating problem here. I have used a thread to create a stopwatch. I want to be able to play, pause and stop. I can get the play to start counitng, the stop to stop it...but..wheni pause...it pauses, yet when i resume the stopwatch, it starts again from 00:00:00:0
II have four int variables.
private int fractionOfSeconds;
private int seconds;
private int minutes;
private int hours;
in the constructor of the thread I am setting them to value 0;
Stopwatch()
fractionOfSeconds = 0;
seconds = 0;
minutes = 0;
hours = 0;
In the run() function I have it increment the values of those variables and pass the result to a label.
public void run()
isPlaying = true;
isPaused = false;
isStopped = false;
try
while(!isStopped && !isPaused)
sleep(100);
fractionOfSeconds++;
if(fractionOfSeconds % 10 == 0 && fractionOfSeconds != 0)
fractionOfSeconds -= 10;
seconds++;
if(seconds % 60 == 0 && seconds != 0)
seconds -= 60;
minutes++;
if(minutes % 60 == 0 && minutes != 0)
minutes -= 1;
hours++;
secondsString = "" + seconds;
if(seconds < 10)
secondsString = "0" + seconds;
minutesString = "" + minutes;
if(minutes < 10)
minutesString = "0" + minutes;
hoursString = "" + hours;
if(hours < 10)
hoursString = "0" + hours;
transportControl.setTimerLabel(hoursString + ":" + minutesString + ":" + secondsString + ":" + fractionOfSeconds);
catch(Exception e)
LOGICALLY speaking..unless I am missing somehing really big, the stopwatch variables should be set to ZERO when the stopwatch class is contrsucted..and after that everytime i run the thread using the run() /start() function the variables should keep increasing..and every time i runit again it should keep counting from where it left off before.
but it doenst. it resets the variables to zero EVERYTIME!!!
Plese.anybody?what am i missing here??
thanx in advance

You can build a stop watch using one of the Timer classes.
- Set the timer to tick every 55 milliseconds (18.2 Hertz) if your on an Intel based machine this is the best resolution you'll get.
- When you start the stopwatch, record the currentMillis
- when the timer ticks use that value and the currentMillis to determing the elapsed time.
- when you pause the stopwatch shut the timer down and record the elapsed time so far
- when you unpause the stopwatch restart the timer
You probably don't even need a separate thread since the timer provide one for you. Note that times set in timers and sleep are not going to be the same as the time actually elapsed since these things run at very low priority.

Similar Messages

  • Chaining "Get Value of Variable" and "Run AppleScript" actions in Automator

    I'm attempting to access a variable I've set in Automator from within a "Run AppleScript Action". On occasion, generally when I start in a fresh new file, I can chain the "Get Value of Variable" action with the "Run AppleScript" action as you would expect.
    Most times, though, they will not chain together. I haven't specified that the "Run AppleScript" action should ignore input, but it behaves that way. I've tried everything I can think of, but I'm out of ideas.
    Am I going about this all wrong? (Thanks in advance for any suggestions!)
    Message was edited by: rch_nashville (for clarity)

    The *Get Value of Variable* action is another quirky one. I'm not sure what causes it to fail, but sometimes putting another (dummy) action in between gets it to work. You can also access workflow variables directly from the Run AppleScript action, so you might also give that a try:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 680px;
    color: #000000;
    background-color: #B5FF6C;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters} -- get values of workflow variables
    set output to {}
    set theVariables to the name of variables of front workflow
    if the result is not {} then
    set theVariables to (choose from list theVariables with multiple selections allowed and empty selection allowed)
    if result is false then error -128 -- cancel
    repeat with someVariable in theVariables
    set the end of the output to (get value of variable someVariable of front workflow)
    end repeat
    end if
    return output
    end run
    </pre>

  • Why do threads run one at a time?

    [Newbie] Couldn't get help in another forum, so here goes. Tried this in Netbeans 3.5 then at home later in BlueJ, same thing. Thanks in advance!
    I have written a small application to play with threads. I create 3 instances of a class and shoot each one off in a thread, but they all seem to run one at a time, not at the same time. I have posted the code below. The output I expect is something like this:
    0T1
    0T2
    0T3
    1T1
    1T2
    1T3
    2T1
    2T2
    2T3
    498T1
    498T2
    498T3
    499T1
    499T2
    499T3
    500T1
    500T2
    500T3
    The T1 means threadstart1 wrote that line, the T3, means threadstart3 wrote the line, etc. I would expect to see these slightly out of order, too, knowing that the threads will process what they can, when they can. Instead, I see this:
    0T1
    1T1
    2T1
    500T1
    0T2
    1T2
    2T2
    500T2
    0T3
    1T3
    2T3
    500T3
    It's in perfect numeric order, each completing before the next starts. What am I doing wrong?
    //-------------dostuff.java
    package delme2;
    public class dostuff implements Runnable {
    private String mtext;
    public dostuff(String atext) {
    mtext = atext;
    public void run() {
    int j;
    String s;
    //display 500 numbers
    for (j=0; j<500; j++) {
    //build the string
    s = String.valueOf(j) + mtext;
    //show the string
    System.out.println(s);
    //wait a bit before doing this again.
    try {
    Thread.sleep(10);
    } catch (InterruptedException e) {
    //--------------- delme2.java
    package delme2;
    public class delme2 {
    public delme2() {
    System.out.println("Thread demo:");
    Runnable threadstart1 = new dostuff("T1");
    Runnable threadstart2 = new dostuff("T2");
    Runnable threadstart3 = new dostuff("T3");
    Thread t1 = new Thread( threadstart1 );
    Thread t2 = new Thread( threadstart2 );
    Thread t3 = new Thread( threadstart3 );
    t1.run();
    t2.run();
    t3.run();
    public static void main(String[] args) {
    delme2 mydelme2 = new delme2();
    }

    Okay, I'll play along. Having written a task scheduler in C (under tutorial, I admit), I think I qualify. A task scheduler has three jobs at all times.
    1) Execute the code at hand.
    2) Figure out when to stop executing the code at hand.
    3) When stopped, figure out what code to execute next.
    When executing a piece of code, there are different paradigms for determining when to stop and move on. Ideally, a cooperative multitasking system would have threads that relinquish timeslices or have some other method sprinkled throughout their code that indicates to the task scheduler that it's okay to move on to another piece of code. In my experience, that indicator is a Thread.Sleep() or equiavalent. when the thread.sleep() is encountered. The task scheduler has nothing to do for a whopping 10 MS. It could even take 15 or 20 ms if the next process in line takes that long. So what is it doing for 10 ms? It's not executing those other threads, which should be queued for their turn on step #3 as soon as I fire them off with a .run().
    Now, I hope you can see that I've given this some thought and read about it, but I'm missing something. I can get a very similar project to work as I expect it to in .NET and in Delphi. The Java environment has something different about it that I haven't figured out. Here's the c# code that does EXACTLY what I want it to. All threads run at a same time, and I get 0,0,0,1,1,1,2,2,2,3,3,3,4,4,4, etc.. See the similarities?
              private void button1_Click(object sender, System.EventArgs e)
                   lst.Items.Clear();
                   ThreadStart start1 = new ThreadStart(runner);
                   ThreadStart start2 = new ThreadStart(runner);
                   ThreadStart start3 = new ThreadStart(runner);
                   Thread t1 = new Thread(start1);
                   Thread t2 = new Thread(start2);
                   Thread t3 = new Thread(start3);
                   t1.Start();
                   t2.Start();
                   t3.Start();
              private void runner()
                   string s;
                   for (int j=0; j<500; j++)
                        s = j.ToString();
                        lst.Items.Add(s);
                        Thread.Sleep(10);
              }

  • Thread cannot access the class variables.

    Hi
    I have below code snippet : (Only section of which I have copied below)
    public class ProcessAppendAction extends HttpServlet implements Runnable{
         public ProcessAppendAction ()
    MI_OS_APPEND port ;
    protected void doGet(
              HttpServletRequest request,
              HttpServletResponse response)
              throws ServletException, IOException {
              //TODO : Implement
    port =
                        (MI_OS_APPEND) obj.getLogicalPort(
                             "MI_OS_APPENDPort",
                             MI_OS_APPEND.class);
    Thread[] threads = new Thread[noOfThreads];
    ProcessAppendAction run = new ProcessAppendAction(req);
                                            Thread th = new Thread(run);
                                            threads[no] = th;          
                                  threads[no].start();
                                  threads[no].join();
    public ProcessAppendAction(DT_REQUEST_APPEND req) {
              this.requestObj = req;
              // TODO Auto-generated constructor stub
    public void run()
              try
                   DT_RESPONSE res = this.port.MI_OS_APPEND(requestObj);
                                  catch(Exception e)
                                       int ch=0;
                                       ch++;
              }     In above code I am successfully creating an object in line :
    port =
                        (MI_OS_APPEND) obj.getLogicalPort(
                             "MI_OS_APPENDPort",
                             MI_OS_APPEND.class);But when I am trying to access this port variable in run method it is giving null.
    Port in my code is a class variable.
    Is it the case that thread cannot access class variable !!

    money321 wrote:
    ok, I have removed join() from just after start().So that now the Servlet can return before the new Thread has finished. Is this what you want?
    First I did invoked all threads and then in second loop i invoked Join on all threads.I don't understand. Why do you need to join() all the threads since you only start one thread in this request. What am I missing?
    >
    Now, my problem.
    It was solved when I substituted the line
    ProcessAppendAction run = new ProcessAppendAction(req)
    with
    ProcessAppendAction run = new ProcessAppendAction(req,port);Of course. Instance variables in Servlet instances are a no-no so passing the 'port' though an instance variable is just wrong.
    >
    That is passes port alongwith req while creating thread object.
    But still if class variables are not thread safe, then it means if I pass object 1 to thread 1.
    And then try to pass object 2 to thread 2, it might be possibility that object 1 of thread 1 might be replaced by object 2.
    So, thread 1 will get an updated value object 2.Yep - that is why you should not use instance variables in Servlets and why they are not thread safe.
    >
    Which is not what I intend to do...:-)

  • Missing substitution value for variable [dispatcher.host]

    Hello,
    I'm getting the error message "com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable [dispatcher.host]." if I'm trying to deploy an SCA file via SDM (remotegui.bat).
    It seems that the problem is a missing variable setting. But I couldn't find any hints at the available SAP web sources which values needs to be set.
    It would be really great if somebody could give me a hint which steps I need to do to solve this issue.
    Many thanks in advance,
    Steffen Zimmermann
    Here is the whole GUI log :
    ==========================================================================
    08/11/26 21:31:15 -  ***********************************************************
    08/11/26 21:31:35 -  Start updating EAR file...
    08/11/26 21:31:35 -  start-up mode is lazy
    08/11/26 21:32:45 -  com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable [dispatcher.host].
                              at com.sap.engine.deploy.manager.DeployManagerImpl.makeTempEar(DeployManagerImpl.java:3747)
                              at com.sap.engine.deploy.manager.DeployManagerImpl.makeNewEar1(DeployManagerImpl.java:3715)
                              at com.sap.engine.deploy.manager.DeployManagerImpl.deployUpdateAction(DeployManagerImpl.java:529)
                              at com.sap.engine.deploy.manager.DeployManagerImpl.deploy(DeployManagerImpl.java:513)
                              at com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performDeployment(EngineApplOnlineDeployerImpl.java:186)
                              at com.sap.sdm.serverext.servertype.inqmy.extern.EngineDeployerImpl.deploy(EngineDeployerImpl.java:96)
                              at com.sap.sdm.serverext.servertype.inqmy.EngineProcessor.executeAction(EngineProcessor.java:224)
                              at com.sap.sdm.app.proc.deployment.impl.PhysicalDeploymentActionExecutor.execute(PhysicalDeploymentActionExecutor.java:60)
                              at com.sap.sdm.app.proc.deployment.impl.DeploymentActionImpl.execute(DeploymentActionImpl.java:186)
                              at com.sap.sdm.app.proc.deployment.controllers.internal.impl.DeploymentExecutorImpl.execute(DeploymentExecutorImpl.java:48)
                              at com.sap.sdm.app.proc.deployment.states.eventhandler.ExecuteDeploymentHandler.executeAction(ExecuteDeploymentHandler.java:83)
                              at com.sap.sdm.app.proc.deployment.states.eventhandler.ExecuteDeploymentHandler.handleEvent(ExecuteDeploymentHandler.java:60)
                              at com.sap.sdm.app.proc.deployment.states.StateBeforeNextDeployment.processEvent(StateBeforeNextDeployment.java:127)
                              at com.sap.sdm.app.proc.deployment.states.InstContext.processEventServerSide(InstContext.java:73)
                              at com.sap.sdm.app.proc.deployment.states.InstContext.processEvent(InstContext.java:59)
                              at com.sap.sdm.app.view.controllers.DeployEventProcessor.processEvent(DeployEventProcessor.java:11)
                              at com.sap.sdm.client_server.deployserver.DeployCmdProcessor.processEvent(DeployCmdProcessor.java:264)
                              at com.sap.sdm.client_server.deployserver.DeployCmdProcessor.process(DeployCmdProcessor.java:108)
                              at com.sap.sdm.gui.server.GuiAdminRoleCmdProcessor.process(GuiAdminRoleCmdProcessor.java:72)
                              at com.sap.sdm.is.cs.session.server.SessionCmdProcessor.process(SessionCmdProcessor.java:67)
                              at com.sap.sdm.is.cs.cmd.server.CmdServer.execCommand(CmdServer.java:76)
                              at com.sap.sdm.client_server.launch.ServerLauncher$ConnectionHandlerImpl.handle(ServerLauncher.java:286)
                              at com.sap.sdm.is.cs.ncserver.NetCommServer.serve(NetCommServer.java:43)
                              at com.sap.sdm.is.cs.ncwrapper.impl.ServiceWrapper.serve(ServiceWrapper.java:39)
                              at com.sap.bc.cts.tp.net.Worker.run(Worker.java:50)
                              at java.lang.Thread.run(Thread.java:534)
    08/11/26 21:32:45 -  ***********************************************************
    Nov 26, 2008 9:32:45 PM  Info: End of log messages of the target system.
    Nov 26, 2008 9:32:45 PM  Info: ***** End of SAP J2EE Engine Deployment (J2EE Application) *****
    Nov 26, 2008 9:32:45 PM  Error: Aborted: development component 'Cognos8BI'/'cognos.com'/'Cog8BIFactory'/'1'/'1', grouped by software component 'Cognos8BI'/'cognos.com'/'Cog8BIFactory'/'1000.8.4.1.0.20081125093532''/'0':
    Caught exception during application deployment from SAP J2EE Engine's deploy API:
    com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable [dispatcher.host].
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).DMEXC)
    Nov 26, 2008 9:32:45 PM  Info: Starting to save the repository
    Nov 26, 2008 9:32:49 PM  Info: Finished saving the repository
    Nov 26, 2008 9:32:51 PM  Info: Starting: Initial deployment: Selected software component 'Cognos8BI'/'cognos.com'/'Cog8BIFactory'/'1000.8.4.1.0.20081125093532''/'0' will be deployed.
    Nov 26, 2008 9:32:51 PM  Error: Aborted: software component 'Cognos8BI'/'cognos.com'/'Cog8BIFactory'/'1000.8.4.1.0.20081125093532''/'0':
    Failed deployment of SDAs:
    development component 'Cognos8BI'/'cognos.com'/'Cog8BIFactory'/'1'/'1' : aborted
    Please, look at error logs above for more information!
    Nov 26, 2008 9:32:51 PM  Info: Starting to save the repository
    Nov 26, 2008 9:32:52 PM  Info: Finished saving the repository
    Nov 26, 2008 9:32:53 PM  Info: J2EE Engine is in same state (online/offline) as it has been before this deployment process.

    Thank you.
    Yes, it was a really not a default variable.
    Replacement of the variables directly at the archive with the correct value did solve the issue.

  • Error when running reset.bat

    Hello,
    I used to get an error while re-deploying some ESB projects on SOA Suite 10.1.3.4.
    This installation is with olite database. To solve this problem,
    I wanted to run reset.bat which is in \OracleAS_1\integration\esb\bin folder.
    reset.bat file gave the below error.
    C:\product\10.1.3.1\OracleAS_1\integration\esb\bin>reset.bat
    Buildfile: build.xml
         [echo] ${env.PCHOME}
    reset-esb:
        [mkdir] Created dir: C:\product\10.1.3.1\OracleAS_1\integration\esb\bkup\201
    01007_1245
         [java] Creating database connection with DB_URL=jdbc:[email protected]:1531
    :oraesb, DB_USER=system DB_PASSWORD=any DB_DRIVER=oracle.lite.poljdbc.POLJDBCDri
    ver.
         [java] Running this Command will reset all the metadata. Existing metadata
    will be backed up. Press y to continue and any other key to exit.
    y
         [java] 7-Oct-2010 12:45:52 PM oracle.tip.esb.lifecycle.HttpHandler logInfo
         [java] INFO: Exporting metadata from the server [host=BCFSL21903,port=8888,
    user=oc4jadmin] to file "C:\product\10.1.3.1\OracleAS_1\integration\esb\bkup\201
    01007_1245\metadata.zip"
         [java] Exported metadata to File C:\product\10.1.3.1\OracleAS_1\integration
    \esb\bkup\20101007_1245\metadata.zip.
         [java] Exported parameters to File C:\product\10.1.3.1\OracleAS_1\integrati
    on\esb\bkup\20101007_1245\esbparam.properties.
         [java] Running:C:\product\10.1.3.1\OracleAS_1\integration\esb\sql\other\dro
    p_esb_tables.sql
         [java] 7-Oct-2010 12:45:59 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeErrorToLog
         [java] SEVERE: Failure:drop table ESB_message_map
         [java] 7-Oct-2010 12:45:59 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeErrorToLog
         [java] SEVERE: Failure:drop table ESB_messages
         [java] 7-Oct-2010 12:45:59 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeErrorToLog
         [java] SEVERE: Failure:drop table ESB_group_status
         [java] 7-Oct-2010 12:45:59 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeErrorToLog
         [java] SEVERE: Failure:drop table ESB_containerid_lease
         [java] Running:C:\product\10.1.3.1\OracleAS_1\integration\esb\sql\other\wfe
    ventc.sql
         [java] Running:C:\product\10.1.3.1\OracleAS_1\integration\esb\sql\other\see
    d_service_types.sql
         [java] Running:C:\product\10.1.3.1\OracleAS_1\integration\esb\sql\other\see
    d_default_system.sql
         [java] Running:C:\product\10.1.3.1\OracleAS_1\integration\esb\sql\other\upg
    rade_10133_10134_oracle.sql
         [java] 7-Oct-2010 12:46:01 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeErrorToLog
         [java] SEVERE: Failure:drop table ESB_message_map
         [java] 7-Oct-2010 12:46:01 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeErrorToLog
         [java] SEVERE: Failure:drop table ESB_messages
         [java] 7-Oct-2010 12:46:01 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeErrorToLog
         [java] SEVERE: Failure:drop table ESB_group_status
         [java] 7-Oct-2010 12:46:01 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeErrorToLog
         [java] SEVERE: Failure:drop table ESB_containerid_lease
         [java] 7-Oct-2010 12:46:01 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeToLog
         [java] INFO: [POL-5128] duplicate table name SYSTEM.XREF_DATA
         [java] 7-Oct-2010 12:46:01 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeToLog
         [java] INFO: WorkflowCA: SQLException during execution: java.sql.SQLExcepti
    on: [POL-5128] duplicate table name SYSTEM.XREF_DATA: CREATE TABLE XREF_DATA
         [java] (
         [java]   XREF_TABLE_NAME   VARCHAR2(2000)    NOT NULL,
         [java]   XREF_COLUMN_NAME VARCHAR2(2000)    NOT NULL,
         [java]   ROW_NUMBER        VARCHAR2(48)    NOT NULL,
         [java]   VALUE             VARCHAR2(2000)  NOT NULL,
         [java]   IS_DELETED        VARCHAR2(1)     NOT NULL,
         [java]   LAST_MODIFIED     VARCHAR2(100)   NOT NULL,
         [java]   LAST_ACCESSED     VARCHAR2(100)   NOT NULL
         [java] )
         [java] 7-Oct-2010 12:46:01 PM oracle.tip.esb.install.db.SQLProcessor$Contex
    t writeToLog
         [java] INFO: File: C:\product\10.1.3.1\OracleAS_1\integration\esb\sql\other
    \upgrade_10133_10134_oracle.sql.
         [java] Exception in thread "main" oracle.tip.esb.install.exception.Installa
    tionDBException: Failed to execute sql file"C:\product\10.1.3.1\OracleAS_1\integ
    ration\esb\sql\other\upgrade_10133_10134_oracle.sql"
         [java]     at oracle.tip.esb.install.db.RunSQLScript.runScript(RunSQLScript
    .java:337)
         [java]     at oracle.tip.esb.install.db.RunSQLScript.runScript(RunSQLScript
    .java:302)
         [java]     at oracle.tip.esb.install.db.RunSQLScript.runScript(RunSQLScript
    .java:259)
         [java]     at oracle.tip.esb.install.db.RunSQLScript.runScriptListInternal(
    RunSQLScript.java:123)
         [java]     at oracle.tip.esb.install.db.RunSQLScript.runScriptList(RunSQLSc
    ript.java:89)
         [java]     at oracle.tip.esb.install.reset.ResetRepository.runSQLScripts(Re
    setRepository.java:327)
         [java]     at oracle.tip.esb.install.reset.ResetRepository.actionReset(Rese
    tRepository.java:275)
         [java]     at oracle.tip.esb.install.reset.ResetRepository.main(ResetReposi
    tory.java:210)
         [java] Caused by: oracle.tip.esb.install.db.SQLProcessorException: SQLExcep
    tion during execution: java.sql.SQLException: [POL-5128] duplicate table name SY
    STEM.XREF_DATA: CREATE TABLE XREF_DATA
         [java] (
         [java]   XREF_TABLE_NAME   VARCHAR2(2000)    NOT NULL,
         [java]   XREF_COLUMN_NAME VARCHAR2(2000)    NOT NULL,
         [java]   ROW_NUMBER        VARCHAR2(48)    NOT NULL,
         [java]   VALUE             VARCHAR2(2000)  NOT NULL,
         [java]   IS_DELETED        VARCHAR2(1)     NOT NULL,
         [java]   LAST_MODIFIED     VARCHAR2(100)   NOT NULL,
         [java]   LAST_ACCESSED     VARCHAR2(100)   NOT NULL
         [java] )
         [java]     at oracle.tip.esb.install.db.SQLProcessor.processLine(SQLProcess
    or.java:1537)
         [java]     at oracle.tip.esb.install.db.SQLProcessor.executeSQLFile(SQLProc
    essor.java:1683)
         [java]     at oracle.tip.esb.install.db.SQLProcessor.runSQLFile(SQLProcesso
    r.java:315)
         [java]     at oracle.tip.esb.install.db.RunSQLScript.runScript(RunSQLScript
    .java:331)
         [java]     ... 7 more
    BUILD FAILED
    C:\product\10.1.3.1\OracleAS_1\integration\esb\bin\build.xml:607: Java returned:
    1   What is the reason for this error?
    Any ideas please.
    Thank You,
    sandaruwan

    Its not dropping the tables so when it recreates if fails. You may need to drop table manually by running the drop_esb_tables.sql script.
    cheers
    James

  • Issue while Passing Values to Variable Dynamically in ODI

    Hi All,
    We are trying to pass values to ODI variable dynamically. The value passed is File path. We are successfully able to achieve this when we are passing the relative path i.e. ‘..\demo\xml’ but while we are trying to pass the absolute path i.e. ‘D:\ODI\oracledi\demo\xml\’ we are getting the below given error in the Load step of the interface..
    com.sunopsis.sql.SnpsMissingParametersException: Missing parameter
    at com.sunopsis.sql.SnpsQuery.completeHostVariable(SnpsQuery.java)
    at com.sunopsis.sql.SnpsQuery.updateExecStatement(SnpsQuery.java)
    at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
    at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
    at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
    at com.sunopsis.dwg.cmd.e.i(e.java)
    at com.sunopsis.dwg.cmd.g.y(g.java)
    at com.sunopsis.dwg.cmd.e.run(e.java)
    at java.lang.Thread.run(Unknown Source)
    Googling for the same has yielded the following results :-
    •     if the file name has : in it then ODI will consider it as a binding variable rather path. .. So try relative path. – Relative Path is working but we need to achieve this by giving absolute path.
    •     make sure you are using LKM File to SQL rather SQL to SQL. – We have tried by 3 different LKMS—File to SQL, SQL to SQL and SQL to Oracle but the error is same in all.
    Any pointers regarding the same will be very helpful.
    Thanks In Advance.
    Regards,
    Abhishek Sharma

    Hi Cezar,
    Thanks for the response. The issue here is we are picking this path from a table. We have FILE_PATH column in one database table and in ODI variable we have given SQL query as 'Select FILE_PATH from tablename'. Then we are taking the refresh value of this variable and passing it on to our interface.
    If the Path in table is given as relative path it works , else for absolute path it doesnt work. How can we achieve the solution recommended by you in this case. The FILE_PATH value in table may change, so we need to pick the file from whatever path it fetches from the select statement. Hence we cannot hard code it here.
    Please suggest.
    Thanks Again.
    Regards,
    Abhishek Sharma

  • A large program with MANY .vi's loads an onboard program to a 7344 board, later in anothor .vi I load a value into var = 1. and then run Onboard program. Program runs but value of var =1 is not used.

    Onboard program calls the "Load constant to variable.vi" in first block. Same call is made in labview code just before the run program block. the variable in the onboard program ALWAYS defalts to (0). WHY???

    Hello,
    Thank you for contacting National Instruments.
    My guess is that the variable is being overwritten by the first call (Load Constant to Variable VI) of the onboard program. The order of operations for the second VI appears to be the following:
    1) Load Constant to Variable (variable 1 = 10000)
    2) Run the onboard program
    3) Onboard program calls Load Constant to Variable (variable 1 = 0)
    Any value that the first step of the onboard program loads (step 3 above) will overwrite the value loaded just before the onboard program runs (step 1 above).
    I have attached an image of the block diagrams for both VIs I used for testing. The first VI loads an initial value into variable 1, starts program storage, loads position, loads veloci
    ty from variable 1, loads acceleration and deceleration, starts motion, then ends storage. The second program simply loads a new value into the variable then runs the stored program. As the variable value in the second program is modified, the velocity changes appropriately. I tested this with a PCI-7344 in LabVIEW 7.1 with NI-Motion 6.1.3.
    Hopefully this will help you track down the source of the problem.
    Best Regards,
    Jesse D.
    Applications Engineer
    National Instruments
    Attachments:
    OnboardTestImage.JPG ‏36 KB

  • Error that "specify a value for variable posting period (single value entry

    hi
    My query is running testing fine in RSECADMIN under some username..but when i try and open it using analyzer (under same username) it gives me error that "specify a value for variable posting period (single value entry, mandatry)" it does'nt even asks to enter variable values and gives this error message.
    However the same query appears to be working fine under different username.
    plz advise.

    Hi Abhinav,
    Just do one thing compare the Roles of two different users for which Query is getting executed and not.
    Check the Object S_RFC.
    Compare the Objects detail for Both the Users.
    Please Assign points if useful.
    Regards,
    Rajdeep.

  • Error-Specify a value for variable

    Dear All,
    We upgraded our BW system to BI 7 SP 15. We are getting following error when executing queries in Bex.
    Specify a value for variable Company Code
        Message no. BRAIN629
    Diagnosis
        The variable cannot be empty. You must make an entry in the variable
        maintenance for variable Company Code.
    System Response
    Procedure
        Enter a value. Use the search help (F4) if necessary.
    Procedure for System Administration
    Interesting thing is that this error is faced by only 2 users in all upgarded systems.
    We created test user with same roles and we are getting error for these test users as well. All other users can run these queries without any problem. When we gave them sap_allprofile, it worked but I dont think this an authorization issue as these user can execute reports in web without any error.
    Second interesting thing is that, I applied note 1085822. This solved the problem. But on next day while closing this issue formally we found it is not working again and giving the same error.
    I checked other notes but these are not suitable for SP15.
    Any pointer/help will be well appreciated.
    Regards,
    Niraj

    Hi All,
    Resolved this issue by giving authorization obj S_BDS_D value display.
    Regards,
    Niraj

  • Default value for variable are not within permitted value range (precalc)

    Hello BW community
    Issue:
    I have created a variable (Characteristic Value/ Manual input-default value) and use the precalculated value set (details-basic settings). In the further variable definition I could select the  precalculated value set in 'Default values', which I have defined beforehand in the broadcaster..
    The precalculated value set in the broadcaster settings is just based on a master data query on 0CUSTOMER.
    Error:
    The variable gets the error E991/R9E Errors: Default values for variable 'XXX' are not within permitted value range.
    The detail description of the error is: You defined default values for variable 'Sold-to party precalc value set for manuel input' that are not appropriate for the variable type; for example, a range is defined as a default value for a variable that only permits a single value.
    So please has someone had the same issue and found out how to solve it? It would be excelent to get good solution for this issue.
    Best regards and thanks
    Christian
    PS-1: System BW 701 / SAPKW70105
    PS-2 : there has been a SDN entry with the same topic but not resolved too.
    link: /thread/980839 [original link is broken]

    Hello,
    Thanks for your response.
    I should have mentioned that in my post. I tried this very first time. I thought that this is the place where you provide default value. But I got following exception at that time, so I thought, may be this is used for something else.
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
    javax.faces.FacesException: javax.servlet.ServletException: OracleJSP error:
    oracle.jbo.NameClashException: JBO-25001: Object viewAllInd of type Control Binding Definition already exists.
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:415)Do I need handle something else when you put the default value?
    Thanks,
    Jai

  • Pass a Value to Variable from the unix environment in ODI (ELT)

    Hi
    i am very new to ODI environment.
    i want know how to pass a value to variables in oracle data integrator from unix environment.
    Example:
    Variable name : Sales
    for variable name sales i want to pass the value from unix environment.
    Regards,
    Raj
    Edited by: user11137587 on Aug 19, 2009 6:26 AM

    Work Around !
    You can execute OS commands using Jython script. Probably you need to flush your enviornment variables value into a file using jython script and then read those value into ODI variable from the file.
    BUt may I know why you want to read environment variable vaules in ODI, Dont you think this will make your application less portable
    Regards,
    Amit

  • # value in Variable Selection screen

    Hello,
              Can you please help with the below:
    How do we remove # (Not Assigned) value from Variable selection screen. When I select PLANT in one of the  report, I see # value. But there are no empty values in the cube. So, I am not sure as why I am getting this # value in Selection Screen.  The seeting in Web designer for READ MODE is "Posted Values" and  not  "Master data or Dimension Table".
    Thanks.

    have you checked what Bex properties are set in the Info Object for "Query Def. Filter Value S"
    Select Values from Info provider.
    that might solve your problem. But ensure you're not disturbing anything else by changing this property.
    Regards, Siva
    Message was edited by:
            Siva Bonam

  • Value  for variable *** hierarchy Version is invalid

    hi ALL
    for one Of the user, when he tries to run the report he is freequently facing this situation. he is getting the error like : "Value  for variable *** hierarchy Version is invalid" . but the same report is working for other users.
    The starange part is . those variables are not mandatory selections, they are userentry optional values.
    we tried with authorization team also . that is not the probelm.
    how can i solve this...
    any ideas?
    Praveen.
    Message was edited

    Praveen,
    Please check if there is any "Personalization of variable" setting for that variable.
    Raju

  • Exception in thread "main" Context Value Management Failed.

    Hi
    I am facing one issue when i regenerate autoconfig.
    We are running Multi Node installation of Oracle EBS on SUN O.S, and
    when I regenerate Autoconfig, I am getting
    Using AutoConfig to configure the Applications environment
    Loading APPL_TOP environment from /u11/oracle/k24eb1appl
    Verifying Context file ...
    found context version : 115.121
    minimum required version : 115.121
    available update version : 115.178
    An update for the Context File is available.
    java.lang.NullPointerException
    at oracle.apps.ad.context.CtxValueMgt.main(Compiled Code)
    Exception in thread "main" Context Value Management Failed.
    Exiting with status 1
    Any Solutions pls
    Reg
    Sundar

    Cross posted in java-forums.
    OP, please do not cross-post without notification such as links to the other cross-posts. Nobody likes duplicating work that's already been done.

Maybe you are looking for