Adding counter variable

Hello all-
I know this has been discussed numerous times but I can't seem to get it working!
I'm trying to start simple first and here is what I am trying to accomplish at this time:
I have three "rectangle" boxes (on the stage), each a symbol(names below) and different color.
blueBox
redBox
greenBox
I have three "text" boxes above them on the stage.
blueCounter
redCounter
greenCounter
I have three variables in the compositionReady action on the stage:
sym.setVariable("redCount", 0);
sym.setVariable("blueCount", 0);
sym.setVariable("greenCount", 0);
What I want to have happen is when you click on the text box for any of the boxes, the box performs an animation and a number gets incremented by one, showing on the stage after the "text" boxes from above:
blueCounter 2
redCounter 5
greenCounter 1
I have the following code in an "onClick" action for the greenCounter text that calls the appropriately colored box:
sym.$("greenBox").show();     // it is hidden on the stage at first-this works fine
var counter = sym.getVariable("greenCount");
counter++;
sym.$("counter").html("green Count: " + counter);
sym.setVariable("greenCount", counter);
But, of course, I'm not seeing anything appear after the  "Green Count:" text on the stage (or the other two)... (except the animation does play)...
I know I'm missing something elementary and if I can get that figured out, I can move on to what I really want to do with this functionality, now and in the future :-)
Any ideas?
Thanks!
James

I've got another question:
Is there a "list" of Edge "restricted code names" (for better lack of words)?
Playing with the code example you sent, I'm still fighting to add the other two "colored boxes".
I was trying to change the following and it breaks, which lead me to believe it is a restricted word used by Edge:
var counter = sym.getVariable("greenCount");
// insert code to be run when the composition is fully loaded here
sym.$('greenCounter').click(function(){
          sym.$("greenBox").show();     // it is hidden on the stage at first-this works fine
          sym.$("greenCounter").html("green Count: " + counter);
          counter++;
I was trying to change the variable "counter" to "greenCounter", redCounter", "blueCounter" but the "counter" broke for the green box.  It shows on the page but doesn't increment past 0.
James

Similar Messages

  • Resetting a counter variable

    I am trying to use counter variable "count". The default for "count" is 0 when the program is opened up. I initialize ssd and sumclick to be 0. However once it goes through the formula node, the value for "count" changes to 1 and then the decision loop within the formula node that checks if "count>0" is used.
    My problem is, if I stop the program and then rerun the program without closing and reopenign the program, the value for count continues to be 1, and so my intialization for ssd and sumclick dont happen. Whenever I hit the run button I want count to be 0. I dont want count to remember the 1 from the previous run. How can I do this?
    The VI is below.

    Hi Charles,
    Thanks for answering my question. The pciture I posted is part of a large program. After I posted the question I reworked on the block diagram to create a base level example to try and figure out what was going wrong. Here is the base level example. I tried to get rid of the formula node in this. i just have a while loop and all LV operations. 
    I am trying to generate a random number, take the deviation^2 of the random number from 1 and then keep adding that cumulatively to make SSD. I want my SSD to begin with 0, everytime I stop and re-run the program. VI Attached. Please look at it and tell me. Thanks for the help in advance. 
    Attachments:
    ssd.vi ‏8 KB

  • Assigning a specific value to the sapscript counter variable

    Hi all,
    I am trying to use the sapscript counter variable in my sapscript but encounter the following warning.
    My code looks like the following:
    /: DEFINE &SAPSCRIPT-COUNTER_0& = 0
    The new counter value is &SAPSCRIPT-COUNTER_0(+)&
    The warning i get when i do the syntax check is:
    Ambiguous symbol &SAPSCRIPT-COUNTER_0&
    What is wrong with my syntax?
    Appreciate any help i can get.

    Hi,
         If i am not wrong you are trying to reinitializing that standard variable. if that is the case one thing, in script we cannot assign values to variable other than at initializing time but here you don't have chance to initialize that variable because that is standard one. More over modifications to standard variable will give some warnings.
    So try to use other than standard one as per your requirement.
    Hope this will help you.
    Regards,
    Aswini.

  • Creating text file from SQL with adding counter in Filename.

    Hi,
    I have a requirement for creating the Tesxt files from Oracle DB which i can achieve by ODISQLUNLOAD.
    But tricky part is that i want have a file name+ counter such that Counter should start with 1 for the first file of the day, then 2,... and reset to 1 for every new date.
    e.g. file0001, file0002,file0003,file0004,.... file0100 and so on for one day.
    But when i will create a file on next day it should be created as again file0001, file0002,file0003,file0004,.... file0100 and so on.
    I may be able to achieve this using some variables but unable to think how could i achieve this.
    Any help would be appreciated.
    Thanks and Regards,
    Mahesh

    Hi Mahesh,
    If the files are loaded as one batch process, for instance, by executing a single package, you could perform a looping function and store the counter as a variable. It would be very similar to the blog post here: https://blogs.oracle.com/dataintegration/entry/using_variables_in_odi_creatin - but you would be using the #counter variable in your filename. Each day that the package is run, the counter starts at 1.
    Hope this will fit your needs.
    Enjoy!
    Michael R.

  • Adding session variable causes Dreamweaver to not recognize recordset

    I have a recordset that I have written in advanced mode, the test checks out fine and dreamweaver reconizes it in "server behaviors" and the code is colorized in "code view". Testing the page in a browser works fine.
    Adding a variable for session username, still checks out with MySQL and saves to the page but is no longer recognized in the "server behaviors" and in "code view" it is no longer colorized. All server behaviors that use a recodset as in repeat regions break and cannot find the recordset. Testing in a browser quickly displays a blank page in firefox and a 500 error in IE.
    This is with a bogus variable, which loads fine.
    mysql_select_db($database_ess, $ess);
    $query_client_bdays = "SELECT clients.clientname, clients.birthmonth, clients.birthday FROM clients WHERE clients.username=username AND CONCAT(YEAR(CURDATE()),'-',birthmonth,'-',birthday) BETWEEN DATE_ADD(CURDATE(), interval 30 day) AND DATE_ADD(CURDATE(), interval 60 day)";
    $client_bdays = mysql_query($query_client_bdays, $ess) or die(mysql_error());
    $row_client_bdays = mysql_fetch_assoc($client_bdays);
    $totalRows_client_bdays = mysql_num_rows($client_bdays);
    Here is with the session
    $varU_client_bdays = "-1";
    if (isset(<?php echo $_SESSION['username']; ?>
      $varU_client_bdays =<?php echo $_SESSION['username']; ?>;
    mysql_select_db($database_ess, $ess);
    $query_client_bdays = sprintf("SELECT clientname,  birthmonth, birthday FROM clients WHERE clients.username=%s AND CONCAT(YEAR(CURDATE()),'-',birthmonth,'-',birthday) BETWEEN DATE_ADD(CURDATE(), interval 30 day) AND DATE_ADD(CURDATE(), interval 60 day)", GetSQLValueString($varU_client_bdays, "text"));
    $client_bdays = mysql_query($query_client_bdays, $ess) or die(mysql_error());
    $row_client_bdays = mysql_fetch_assoc($client_bdays);
    $totalRows_client_bdays = mysql_num_rows($client_bdays);
    I have also included a screen shot of the mess in code view.
    Thanks for any help in advance!

    Found the answer, changing from  <?php echo $_SESSION['username']; ?>  to   $_SESSION['username'];  resolved the issue.

  • BPM Counter Variable

    FILE1---> XI -->  IDOC
    I have a BPM to receive the File. Do the Transformation and then send to R/3 as requested. This scenario is working fine for me. The only problem I have is, I need to send a mail at the end of the process, saying that how many IDOCs were sent to R/3.
    I have introduced a Counter Variable(SimpleType,Integer) and counting each time an IDOC is created.
    But when I add a new step to send the Counter Variable, I dont even see that variable in the Message variable of the SEnd Step!!!
    What am I doing wrong?

    Hi Mohan,
    you cannot send variables - only messages
    (there's no way to map variable to a message in BPM)
    how can you do your scenario?
    you can do 1:2 mapping
    you can map your file to 2 kinds of messages:
    - idoc
    - message with one field(conuter)
    then map file to those 2 messages and counter has to contain the number of idocs
    then you'll be able to use it in send step:)
    BTW
    if you're not using combined IDOC have a look at my weblog:
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • Global Counter Variable - Graphical Mapping

    Hi there.
    Can anybody help with implementing a global counter variable in the graphical mapping please.
    I am trying to populate the "SEGMENT" field of an IDoc with the correct sequence, i.e. add 1 for each new segment. The IDoc has several segments, most of which are embedded. I have tried using the "<b>counter</b>" function but this seems to reset back to one for each instance of it being called.
    I would appreciate any pointers.
    Thank you.
    Mick.

    Hi see this for implementation
    <b>defining Global Variables</b>
    ArrayList arrVI;
    int counter =0;
    <b>Initialization Section</b>
    arrVI= new  ArrayList();
    <b>assignment</b>
    arrVI.add(sVI[iLoopCounter]);
    counter++;
    <b>
    fetch Values</b>
    for (int i =0;i<counter;i++)
    result.addValue(arrVI.get(i)+"");
    Mudit

  • Need to keep track of URL and a count variable

    Can anyone suggest the best way to keep track of a URL and a count variable associated with each URL. I have started using 2 List objects. When I add a URL I also add a 1 in the count List Object. I am using List Objects because I must be able to sort them and search through them.
    Can anyone verify that I am going about this the correct way?
    Thanks

    I would probably use a TreeMap that referenced the counter.

  • Page Counter Variable & Captivate 4

    Hello - I can't get a simple page counter variable to work that I snagged from Captain Captivate. When I click to preview, the project will not show. I’ve tried F4 and F12, it will not preview the project. When I click F3, it shows the variable text. I’ve downloaded his sample file, this will not preview either. When I delete the variable the previews work. Any ideas on how to solve this problem or is there another option for creating a simple page counter?
    Thanks!!

    Hello,
    You are talking about a slide number? There is a system variable cpInfoCurrentSlide that gives you that number. To have it on all the slides:
    insert a Text Caption on the first slide, in which you insert this system variable, you can add other text as well
    change the timing of this Text caption to 'for rest of project'
    preview: you will have the slide number on each slide.
    If you want to know more about variables, I posted something for starters. The link is in this blog post:
    Curious about variables in Captivate (4 & 5)?
    And if you want to know more, can recommend a Goober guide by the moderator of this CP-forum, Captiv8r:
    Variables and advanced actions
    Lilybiri

  • Adding environment variables to Runtime.exec()

    Hello,
    I'm trying to use Runtime.getRuntime().exec(command, envp);
    When envp is null the program launches properly. (the doc says that the subprocess inherits the environment settings of the current process).
    I want to add an environment variable, so when I use an array containing only my variable (envp), the process fails. I guess it needs the variables of the current process (as used when using null).
    In that case, How adding a variable instead of replacing the default ??????
    (I did not see any way to retrieve these default variables so I can concatenate with the custom one)
    Thanks !

    Use a wrapper script that is launched with a default environment and first sets the custom variable and goes on with your program.

  • Character Count Variable

    Hi,
    Is it possible to set the 'chacters remaining' as a variable for Text area with c/count, this is because I have a comments field that is adding to a column that is already populated so the characters remaining will vary depending on what is already in the table
    I know its set in the max width of the elemant section but you cant seem to put a variable name in there.
    Thanks ANDY

    hey andy--
    you can't currently refer to session state values from the maxWidth field as you're finding. i've logged that as an issue, but you can work out your "characters remaining" request for now by calling our charCount jscript function from somewhere you can reference session state. to do so, take a look at the html that's generated when you use those "Textarea w/Character Counter" item types. you'll see that the form element has a jscript call in it that looks something like...
    onKeyUp="javascript:charCount('P3_MY_TEXAREA',255,'tAreaCtr8','tAreaMax8','theBlock8');" onChange="javascript:charCount('P3_MY_TEXAREA',255,'tAreaCtr8','tAreaMax8','theBlock8');"
    ...and you'll see a div and span combo right after it that looks something like this...
    <div style="font-size:8pt;visibility:hidden;" id="theBlock8"><span id="tAreaCtr8"></span> of <span id="tAreaMax8"></span></div>
    ...so you could put code similar to this into a regular TextArea item to call our charCount function while passing it the dynamic value. to do so, you'd put your div/span combo in the "Post Element Text" section of your TextArea item. you'd then want to call charCount by passing it the dynamic value. unfortunately, you can't just put that call into the "HTML Form Element Attributes" because that field currently doesn't support session state references. instead, you'd have to put in a call to a function of yours that calls our charCount. so a call like this...
    onKeyUp="javascript:callCount();" onChange="javascript:callCount();"
    ...just worked in my test case. i defined my callCount funtion in the "HTML Header" field of the page-level atttributes screen as...
    <script language="JavaScript1.1" type="text/javascript">
    function callCount(){   
    charCount('P3_MY_TEXAREA',&P3_X.,'tAreaCtr8','tAreaMax8','theBlock8');
    </script>
    ...and, as you can see, it just calls callCount while passing it my dynamic P3_X value instead of the fixed maxWidth one. having said all this, it's still our recommendation to not directly call the javascript functions that ship with htmldb. we reserve the right to change how those "internal" calls are implemented. to play it absolutely safe, you'd be better off to copy our charCount function into your app (presumably in a .js file) and call that copy using the same work around i specified above.
    hope this helps,
    raj

  • How to reset a count variable in a conditional format trigger

    I am using a conditional format trigger to eliminate sections of a report where there is no data. The trigger is automatically generated by reports (shown below). the condition is :com_count = '0' therefore no record, no display of section - if :com_count>0 then data present and display record.
    It works fine eliminating the sections - until actual data is found - and count is set to 1 and it displays the record. The problem is that once :com_count >0, then the section displays throughout the rest of the report whether there is actually data or not.
    It seems that :com_count needs to be reset to 0, but when I try to do that, it throws an error stating that :com_count is a read only variable.
    I am new to PL/SQL so can anyone suggest how I can reset the :com_count to 0 each time the trigger fires with :com_count = 1?
    Any help would be appreciated. Thanks,
    Glenn
    The conditional format trigger is:
    function M_G_COM_RANK_GRPFRFormatTrigge return boolean is
    begin
    -- Automatically Generated from Report Builder.
    if (:COM_COUNT = '0')
    then
    return (FALSE);
    end if;
    return (TRUE);
    end;
    The count
    It works perfectly

    wher is your COM_COUNT defined?
    If should be defined in the datamodel in the "mastergroup" of the "detailgroup" of which you want to count the records.
    If you do so, there is a property of the item "Reset at" ( which is by default set to "Report") and you then can change it to the name of the mastergroup. So every time a new record is "active" in the mstergroup, the count-item will be reset to 0.
    hope this helps

  • Adding a variable in a Message Popup

    Hi guys, how to get a local variable in a message Popup? I try "string text"+ Runstate.Caller.Locals.foo ... Coz runstate is while program is running, Caller is the calling step and then local variable.
    But this give an error. Where to access my local variables while running?

    First of all, it depends on the data type of the variable. String can be added "similar" to the way you described. Numeric and boolean has to be cast.
    Second, you seem to misunderstand the concept of the RunState-property. If you want to insert a local variable of the sequence you are currently running, the expression should be:
    "My Dialog Text " + Locals.<localname>
    Don't forget type casts if not working with string variables!
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Sql Queries - adding calculated variables to views

    Hello:
    I'm trying to do add a calculated variable to my view that isn't an Entity
    Attribute, its simple really but i don't know if I'm leaving something out or
    not.
    I add the "new Attribute" , call it nCompleted, type - number
    I then check off everything as is required(as documented in Help)
    for an Sql Derived Attribute, the following code is entered in the
    Expression Box :
    Select group_services.office, count(client_group_services.clnt_group_services_id) as nCompleted
    Where group_services_id=client_group_services_id(+)
    And client_group_services_id.result="Completed";
    It isn't working, what am I missing????

    Hello:
    I'm trying to do add a calculated variable to my view that isn't an Entity
    Attribute, its simple really but i don't know if I'm leaving something out or
    not.
    I add the "new Attribute" , call it nCompleted, type - number
    I then check off everything as is required(as documented in Help)
    for an Sql Derived Attribute, the following code is entered in the
    Expression Box :
    Select group_services.office, count(client_group_services.clnt_group_services_id) as nCompleted
    Where group_services_id=client_group_services_id(+)
    And client_group_services_id.result="Completed";
    It isn't working, what am I missing???? Sheena:
    It probably isn't working because of missing 'group by' clause. I don't know the exact detail of your query statement, but suppose you want to count number of employees in a dept, then you're query should look like:
    select dept.deptno, dept.dname, count(emp.empno) as nCount
       from dept, emp where dept.deptno = emp.deptno(+)
       group by dept.deptno, dept.dname  // This group-by is important
    OR if you want to use nested SELECT
    select dept.deptno, dept.dname,
       (select count(emp.empno) from emp where dept.deptno=emp.deptno(+)) as nCount
       from dept

  • Count = variable date format

    I've got a form where the action="page.php" When on this page, I also have a recordset that counts the rows that have the same date variable called from the $_POST.
    the recordset name = datedal
    variable type = date
    Default value = 0
    Runtime value = $_POST['date_dal']
    Obviously my default value is wrong. I've tried to test using 2008-07-01 and its worked. I use the datepicker to get the date in the form.
    But I've tried default values of dates, 0000-00-00, 2008-07-01 but nothing has worked. Please help.
    thanks!

    Problem solved.

Maybe you are looking for