[SOLVED]Global variable in SH script

Hi.
The real code is:
TOTAL_UPG=0
TOTAL_INS=0
TOTAL_DEL=0
STRING_UPG=`echo $1|sed -e 's/\[/\\\[/g;s/\]/\\\]/g'`
LINEA_UPG=`grep -n "$STRING_UPG" $PACMANLOG|awk -F: '{print $1}'`
tail -n `expr $NUM_LINES_PACLOG - $LINEA_UPG 2>/dev/null` $PACMANLOG 2>/dev/null| while read -r linea
do
echo $linea|grep -i "starting full system" >/dev/null
if [ $? -eq 0 ]
then
echo "$TOTAL_UPG $TOTAL_INS $TOTAL_DEL"
break
fi
echo $linea|grep -i "upgraded" >/dev/null
if [ $? -eq 0 ]
then
TOTAL_UPG=`expr $TOTAL_UPG + 1 `
else
echo $linea|grep -i "installed" >/dev/null
if [ $? -eq 0 ]
then
TOTAL_INS=`expr $TOTAL_INS + 1 `
else
echo $linea|grep -i "removed" >/dev/null
if [ $? -eq 0 ]
then
TOTAL_DEL=`expr $TOTAL_DEL + 1 `
fi
fi
fi
done
echo "$TOTAL_UPG $TOTAL_INS $TOTAL_DEL"
I'm trying to parse the pacman.log
When I exec this the exit is 0 0 0, but the lastest value of $TOTAL_UPG was 7.
Edit: Bad example for my problem
Last edited by neurowasho (2008-12-17 23:19:40)

Thanks for the fast reply, but was a misspelling, the condition was -ne.
The real code is:
TOTAL_UPG=0
TOTAL_INS=0
TOTAL_DEL=0
STRING_UPG=`echo $1|sed -e 's/\[/\\\[/g;s/\]/\\\]/g'`
LINEA_UPG=`grep -n "$STRING_UPG" $PACMANLOG|awk -F: '{print $1}'`
tail -n `expr $NUM_LINES_PACLOG - $LINEA_UPG 2>/dev/null` $PACMANLOG 2>/dev/null| while read -r linea
do
echo $linea|grep -i "starting full system" >/dev/null
if [ $? -eq 0 ]
then
echo "$TOTAL_UPG $TOTAL_INS $TOTAL_DEL"
break
fi
echo $linea|grep -i "upgraded" >/dev/null
if [ $? -eq 0 ]
then
TOTAL_UPG=`expr $TOTAL_UPG + 1 `
else
echo $linea|grep -i "installed" >/dev/null
if [ $? -eq 0 ]
then
TOTAL_INS=`expr $TOTAL_INS + 1 `
else
echo $linea|grep -i "removed" >/dev/null
if [ $? -eq 0 ]
then
TOTAL_DEL=`expr $TOTAL_DEL + 1 `
fi
fi
fi
done
echo "$TOTAL_UPG $TOTAL_INS $TOTAL_DEL"
I'm trying to parse the pacman.log
When I exec this the exit is 0 0 0, but the lastest value of $TOTAL_UPG was 7.

Similar Messages

  • Accessing Global variable which is in another script file

    Hi,
    I have 2 scripts as File1.scpt and File2.scpt in desktop. I am in need of having the common global variable 'GG'.
    File1.scpt has only the following code
    *global GG*
    *Set GG to "I am global"*
    File2.scpt has
    +set file1 to (load script file "Macintosh HD:Users:mowri:Desktop:File1.scpt")+
    +display dialog m+ -- not working -- Error message: "The variable m is not defined"
    +display dialog m+ of file1 - not working -- Error message: "Can't make m into type string"
    It will be great help if you can clarify about my mistakes in this?
    Regards
    Mowri

    Another solution, shorter than the previous one:
    File1.scpt
    set GG to "I am global"
    File2.scpt
    set file1 to (load script file "Macintosh HD:Users:mowri:Desktop:File1.scpt")
    run file1
    display dialog GG
    Ref.: [Handlers in Script Applications - run Handlers|http://developer.apple.com/mac/library/documentation/AppleScript/Conce ptual/AppleScriptLangGuide/conceptual/ASLRabout_handlers.html#//appleref/doc/uid/TP40000983-CH206-SW14]
    Message was edited by: Pierre L.

  • Accessing a variable from another script

    Is it possible to create a global variable in VB in the Job VBA code and to access it from VB in the scripts contained in that job? I want to dynamically create a value (a random email address) for use in one script where it is used for registration and then use it again in a second script for login.

    I had a similar requirement and used a slightly different approach to solve it.
    I had to produce some random char strings that would be client IDs to create test client records in my web app. I needed to reference these random client IDs in both a create script and a modify script.
    I found that (and I guess this can come down to personal preference) it was easy to create a "utility function" that writes a file with however many random strings you want in csv format. If your target scripts don't have databanks, just play this sub in the VBA editor, and then throw the output file into the databank folder and databank the field of interest. For subsequent runs, just play the sub in the VBA editor for fresh data. Worst case, you have an existing databank, and you just need to paste this file into it in excel as a new column. Not a big deal. Here's an example of a function I have that I changed such that it would create a list of random email addresses to a csv file everytime you run the sub in VBA. Just drop this in your VBA workspace sharedmodule:
    Private Sub CreateMemberEmailFile()
    Dim intA As Integer
    Dim sngA As Single
    Dim strA As String
    'Dim x As Integer
    Dim str As String
    Dim answer As Boolean
    Dim fs As Scripting.FileSystemObject
    Dim myfile As Scripting.TextStream
    Set fs = New Scripting.FileSystemObject 'Create a new file system object
    ' put the file anywhere you want, doesnt matter
    Set myfile = fs.OpenTextFile("c:\memberemailid.csv", ForWriting)
    myfile.WriteLine "MemberEmailID"
    ' ok, this creates 50 random emails...feel free to change 50 to whatever you desire
    For y = 1 To 50
    str = ""
    For x = 0 To 9
    'sngA = Rnd
    'Select Case (CInt(sngA * 200) Mod 3)
    ' Case 0
    ' intA = CInt(sngA * 48) + CInt(sngA * 10)
    ' intA = 48 + (intA Mod 10)
    'Case 1
    ' intA = CInt(sngA * 65) + CInt(sngA * 26)
    ' intA = 65 + (intA Mod 26)
    'Case 2
    ' intA = CInt(sngA * 97) + CInt(sngA * 26)
    ' intA = 97 + (intA Mod 26)
    'End Select
    'make intA a random number from 0-9
    intA = RandNum(0, 9)
    strA = CStr(intA)
    str = str & strA
    Next x
    str = str & "@test.com"
    myfile.WriteLine str 'write the message to identify a different line
    Next y
    myfile.Close 'Close the file
    Set myfile = Nothing ' Release the variables
    Set fsoData = Nothing ' Release the variables
    End Sub

  • Unit Testing and APEX Global Variables

    We've recently started to unit test our database level PL/SQL business logic.
    As such we have a need to be able to simulate or provide output from PL/SQL APEX components in order to facilitate testing of these components.
    Some of the most obvious portions that need simulation are:
    1. The existence of a session
    2. The current application ID
    3. The current page ID.
    We currently handle requirement #1 by using apex_040100.wwv_flow_session.create_new
    We handle 2 and 3 using the apex_application.g_flow_id and g_flow_step_id global variables.
    I'm just wondering, how safe is it for us to use wwv_flow_session.create_new to simulate the creation of a session at testing time for those things which need a session?
    I've also noticed that there are apex_application.get_application_id and apex_application.get_page_id functions whose output is not tied to the global variables (at least in our current version).
    Is it safe for us to expect that we can set these global variables for use in testing or is apex moving to get_application_id and get_page_id functions away from global variables?
    Will there be corresponding set_application_id and set_page_id functions in the future?
    Sorry for the question bomb. Thanks for any help.

    My first question would be why do you need to establish a session to test your PL/SQL?
    wwv_flow_session is a package internal to APEX, and you should probably leave it be.
    The get_application_id procedure you refer to is in apex_application_install, which is used for scripting installation of applications - not get/set of page ID like you're describing.
    If you're uncomfortable using apex_application.g_flow_id, you can use v('APP_ID') or preferably pass the app_id/page_id as parameters to your procedures.
    Your question seems to have a few unknowns, so that's the best I can describe.
    Scott

  • How do I add a global variable to my app?

    Hi all,
    I am building a flex app which displays data in different tabs from a mysql database and I wan't to add a sign in process to make sure only registered users of the mysql db can see the data.
    To achieve this I built a sign in component which accepts a username, password and the name of the database to connect to. My flex app then uses a php script to verify that the user can connect to the database using the details entered. If not, the sign in component displays an error message, but if sign in details are verified then the user can see the data from the database.
    How can I store the details in the flex app for that users session so that when the user queries the db for data, flex uses the details entered during the sign in process to connect to the mysql db and submit the query?
    I thought about storing the details as an array in a global variable and then accessing that global variable from anywhere in my app but I don't know if that is the correct/secure way to do what I want, nor do I know how to do it. Any help would be much appreciated.
    Thanks in advance,
    xander

    quick, dirty example, could be improved on but it'll get you rolling;
    After user login has succeeded, send off another HTTP service eg;
    ========
    <mx:Script>
             <![CDATA[
                public var whateverUserNameWasEntered:String;
                 public var whateverUserPasswordEntered:String;
         public function onLoginSuccess():void
              whateverUserNameWasEntered:String = loginbox.text;
              whateverUserPasswordEntered:String = passwordbox.text;
              storeSessionStuff.send();
         ]]>
        </mx:Script>
    <mx:HTTPService id="storeSessionStuff" showBusyCursor="true" method="POST"  url="http://localhost/store.php" useProxy="false">
            <mx:request xmlns="">   
              <username>
                   {whateverUserNameWasEntered}
              </username>
              <password>
                   {whateverUserPasswordEntered}
              </password>       
            </mx:request>
        </mx:HTTPService>          
    ========
    direct it to the php file.....
    <?php
    session_start();
    $_SESSION['username'] = $_POST['username'];
    $_SESSION['password']   = $_POST['password'];
    ?>
    Then, whenever you want to get the information out of the Session, send off another HTTP Service...;
    <mx:HTTPService id="getSessionStuff" result="storeData(event)" showBusyCursor="true" method="POST"  url="http://localhost/get.php" useProxy="false"/>
    to the php file....
    <?php
    session_start();
    print "<details><username>".$_SESSION['username']."</username><password>".$_SESSION['password'] ."</password></details>";
    ?>
    which, you need a result function for:
    <mx:Script>
             <![CDATA[
              private function storeData(evt:ResultEvent):void
                    var username:String;
                    var password: String;
                   username = evt.result.details.username;    
                   password = evt.result.details.password;         
          ]]>
    </mx:Script>
    ta daa
    (if thats what you meant)

  • Data manager package log does not show Global variables!!

    Hello Experts,
    We are using BPC 10 sp14 Microsoft version with SQL Server 2008 R2. We are seeing an issue where datamanager package log does not show the Global variables defined in package script whereas in BPC 7.5 Global variable were visible in package log.
    Please let us know is this behavior changed in BPC 10?
    Below is the package script having Global variables and Package log not showing any of them.
    Thanks & Regards,
    Rohit
    Package Script:
    Package Log:

    Hi Ergin,
    As far as I remember it's by design...
    Vadim

  • How can I access global variables in a loaded Applescript?

    How can I access global variables in a loaded script, in Xcode, ApplescriptObjC? Basically, I have a global variable defined in my parent script using "property", and I need to modify objects connected to those variables inside of a loaded script.
    Example:
    Parent script:
    script AppDelegate
    property myTextField : missing value
    //linked to a text field object
    tell myScript to myAwesomeHandler_()
    end script
    Loaded script:
    on myAwesomeHandler_()
    myTextField's setStringValue_("The new Xcode is so glitchy ugh")
    //changes value of linked text field of parent script
    end myAwesomeHandler_
    The problem is, the variable is undefined in the Loaded script, and I need it to have the same value as the parent script, and I don't want to pass the variable through the Handler. Any ideas?

    I think want you are looking to do will need to be done in two steps. Because myTextField needs to be a property for the ObjectiveC part of the code you cannot turn it into a global.
    However if you make a temporary variable global assign the string to it in the handler then set myTextField off of it.
    global myTextFieldGlobal
    script AppDelegate 
    property myTextField : missing value 
    //linked to a text field object 
    tell myScript to myAwesomeHandler_() 
    myTextField's setStringValue_(myTextFieldGlobal)
    end script 
    on myAwesomeHandler_() 
    set myTextFieldGlobal to "The new Xcode is so glitchy ugh"
    //changes value of linked text field of parent script 
    end myAwesomeHandler_ 
    I know you stated you did not want the handler to return a value but I have to ask why? Global's, imo, are not a good idea and really should be used as a last resort.
    One other possibility is to pass a reference to the property to the handler. Not sure if that works in AS of if that would satisfy our requirement of not passing the variable through the handler
    <edit>
    Another though have you tried to define the property outside the script?  That is
    property myTextField : missing value
    script AppDelegate
    Not sure if that will work.
    You might also want to have a look at Scope of Properties and Variables Declared in a Script Object

  • How to modify global variable in a function?

    Hello,
    I want to modify a globalvariable in a function, at first I did it this way:
    class Global_output_class
    GlobalDim("Correlation_Status,fail_part,End_Exp")
    dim pouet
    Correlation_Status = 12
    Call Correlation()
    pouet = Correlation_Status
    Function Correlation()
    Dim Global_output_class_sub
    Set Global_output_class_sub = new Global_output_class
    Correlation_Status = 1
    fail_part = 2
    End_Exp = 3
    Global_output_class_sub.CorrelationStatus = Correlation_Status
    Global_output_class_sub.failpart = fail_part
    Global_output_class_sub.EndExp = End_Exp
    set Correlation = Global_output_class_sub
    End function
    In this case: correlation_status receive the value 12, then I go to my function correlationn() where it became 1
    Then it goes out of the subfunction and takes the previous value from the program(12) ( I dont want that)
    To solve the problem I made it this way:
    class Global_output_class
    public CorrelationStatus
    public failpart
    public EndExp
    end class
    GlobalDim("Correlation_Status,fail_part,End_Exp")
    Correlation_Status = 12
    Set Global_Output = Correlation()
    Correlation_Status = Global_Output.CorrelationStatus
    fail_part = Global_Output.failpart
    End_Exp = Global_Output.EndExp
    pouet = Correlation_Status
    Function Correlation()
    Dim Global_output_class_sub
    Set Global_output_class_sub = new Global_output_class
    Correlation_Status = 1
    fail_part = 2
    End_Exp = 3
    Global_output_class_sub.CorrelationStatus = Correlation_Status
    Global_output_class_sub.failpart = fail_part
    Global_output_class_sub.EndExp = End_Exp
    set Correlation = Global_output_class_sub
    End function
    This way my global value are recopied in themselves after leaving the subprogram
    I got a lot of variables, is there any easier way so the global variable modified in a function keep the value after leaving the function?
    Thanks for help,
    Fred
    Solved!
    Go to Solution.

    Hi Fred,
    it is possible to use a global defined variable but the better way is to use to use a funtion call (or procedure call) with parameters. Please find first the good solution for a funcion call with parameter and the sub-optimal way with an global valiable:
    dim oParameter
    set oParameter = new cGlobal_output_class
    oParameter.Correlation_Status = 12
    msgbox "Correlation_Status before Call Correlation: " & oParameter.Correlation_Status
    Call Correlation(oParameter)
    msgbox "Correlation_Status after Call Correlation: " & oParameter.Correlation_Status
    Function Correlation(oPara)
    msgbox "Correlation_Status in the FUNCTION before change: " & oPara.Correlation_Status
    oPara.Correlation_Status = 1
    oPara.fail_part = 2
    oPara.End_Exp = 3
    msgbox "Correlation_Status in the FUNCTION after change: " & oPara.Correlation_Status
    End function
    class cGlobal_output_class
    dim Correlation_Status,fail_part,End_Exp
    end class
    call GlobalDim("oPouet")
    dim oPouet
    set oPouet = new cGlobal_output_class
    oPouet.Correlation_Status = 12
    msgbox "Correlation_Status before Call Correlation: " & oPouet.Correlation_Status
    Call Correlation()
    msgbox "Correlation_Status before Call Correlation: " & oPouet.Correlation_Status
    Function Correlation()
    msgbox "Correlation_Status in the FUNCTION before change: " & oPouet.Correlation_Status
    oPouet.Correlation_Status = 1
    oPouet.fail_part = 2
    oPouet.End_Exp = 3
    msgbox "Correlation_Status in the FUNCTION after change: " & oPouet.Correlation_Status
    End function
    class cGlobal_output_class
    dim Correlation_Status,fail_part,End_Exp
    end class
    Greetings
    Walter

  • Setting the value of an Application Item (setting a global variable);

    In APEX 3.2.0.00.27, I need to initialize a global variable to 0 to implement a variable for testing to see if anything on the page has changed. Will update to 1 when certain select lists on the page are changed. Have read through some similar questions and replies within the forum as well as other blogs and sites. So, I believe what I am doing is the way to go about this. Unfortunately, my initialization of an application item/global isn't happening yet. here's a rundown of what has been implemented:
    1) created an application item, G_CLASSIFICATION_ID_NEW in the shared components;
    2) created Javascript (JS) function called by addLoadEvent in the page html header region so when the page loads, the G_CLASSIFICATION_ID_NEW global/application item should get set to 0 with the following JS and using AJAX and htmldb_GET:
    <script type="text/javascript">
    function initVars()
    alert("before get initvars");
    var get = new htmldb_Get(null,$x('pFlowId').value,null,22);
    get.add('G_CLASSIFICATION_ID_NEW', 0);
    gReturn = get.get();
    if(gReturn){
    alert(gReturn.value);
    get = null;
    alert("after get initvars");
    alert("before call to initpage");
    addLoadEvent(initVars());
    </script>
    I've used the htmldb_Get with success for populating other global variables and running On Demand Processes with onchange JS calls in the html form element attributes within select lists on the page. Afterwards, I can check the globals via the Session window and searching on Application Items. Unfortunately, I'm missing something because my G_CLASSIFICATION_ID_NEW never gets populated when I load the page. The alerts all popup when the page is loaded, so I know the script is being executed when the page loads. the alert(gReturn.value) comes back undefined. And, needless to say, the G_CLASSIFICATION_ID_NEW to 0 is not occurring.
    I've tried the htmldb_Get with it calling an application process and without (set to null). From what I've read, you shouldn't need to call an on demand process to have the get.add set the global variable. Then again, this could be where I'm going wrong. however, as I've mentioned, this works for other functions called from an onchange to populate an application item, but the page has already loaded when the onchange(s) get executed. They may work because the page is already loaded when the onchange is called. My point here is that my other On demand processes are NOT setting or changing the global variables at all. The globals are getting set with the get.add(<app item>, <value>) portion of my other JS functions within the HTML Header region. So, I'm inclined to believe that I don't need the 'application_process=<some_odp>' parameter set, but if that's not true, please let me know. if so, what would need to be in the on demand process--ie, what would be the purpose of the get.add(<application item>, <value>) if I set the global variable in the on demand process because that's the only thing I could think of doing within an on demand process for this?
    If somebody can point out what I'm not understanding or failing to do here, that would be great. I'm doing fine with APEX, but wouldn't consider myself a guru with it just yet. I'm definitely not a JS/AJAX guru, and when things like this go astray, I get bogged down because I'm not sure of the problem. So, I'm hoping you gurus who monitor this forum can get me going in the right direction.
    thanks,
    bob

    Hi Jari,
    Does that javascript work if you place it some of region footer on page 22 ?Yes. I cut it out of the html header of the page, and put it in the footer of the first region on the page. It initializes the variable. Putting it into the footer of the first region on the page should work for me instead of having an extra region on the page that's being picked up from page 0.
    Is your page 22 authentication public ?No. This particular page is set for an ADMINISTRATOR only. That said, I am logged in as an administrator. So, I cannot see why setting authentication should make a difference as long as I have that authentication/authorization. Also, there will be other pages where I want to use this script or a similar script, but again, those pages will not be open to the public. the authentication will be "role" based where a user will not necessarily have to be an administrator, but they will have to have a certain role to access the page. Is there a known problem or something that precludes a html header JS script from doing an addloadevent when authentication is NOT public?
    thank you,
    bob

  • Dynamic CSV file name in target (Multiple workflow calling same dataflow with new global variable value)

    Hi their,
    I have multiple data flows doing 90% of the process same. The difference is in source query where clause and target flat file.
    I used the global variables to dynamically change the query where clause easily, but I need help in dynamically changing the target flat file (CSV file).
    What I want to do is have multiple workflows, which will first set the global variable to new value in the script box and then call the same data flow.
    Please let me know if you have any solution or any idea which might put me in the direction to my quest for solution.
    thank you,

    Hi Raj - in your content conversion for lineitem .. read the additional attribute as well.
    Change your source strcture and additional field company_code
    As you are already sending the filename for each line item using the UDF.. it's just you need to modify your UDF to take another input i.e. Company Code.
    or
    If your PI version is > 7.1 use the graphical variable to hold the filename..
    and while sending the company code information for every item just use the concat function to append filename & company code..
    http://scn.sap.com/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable

  • Set file name by global variable

    Hi,
    I am trying to load data from excel file. I have created batch job with global variable $GV_FileName. When I set a global variable value in a script inside Workflow the data load successfully. When I set a global variable value as a job property I receive the error: "The variable <$GV_FileName> of the is empty. Please initialize the variable to a valid value." But in  debug mode I see that the variable is not empty.
    Thanks in advance.
    Lyudmila

    In the job -> properties -> Global Variables tab you set the default value. The actual value used is set when executing the job. Could it be that?

  • Can I use the timestamp of a Network published global variable to reduce network traffic?

    I would like to use a couple of network-published global variables that will contain large clusters of data.  I want to host them on one device but read them from several - consider a distributed control system.  The data will update very infrequently, but, when it does, I want all my HMIs to know quickly.  I can have all the HMIs just read the data 4x/second (that would be fast enough) but I was wondering if there is a more elegant solution (still using global variables).  If I read only the timestamp 4x/second from each of the HMIs, compare it to the last read, and then poll the whole variable only if the timestamps are different, will that require less resources than just grabbing the whole variable every time?  In other words, does reading the timestamp use the same amount of resources as reading the whole variable?
    With really simple code, assuming the "Setup Data" cluster is quite large, does....
    ...get me any advantage over...
    Solved!
    Go to Solution.

    mark3545 wrote:
    So that means they are already doing what I want anyway, right?  If the reader only gets updated when the writer changes it, I can poll it as often as I want without increasing traffic, correct?
    That is correct.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Global variable in XSLT

    Hi,
    I have a requirement in XSLT mapping where i sum up all the data related to amount field and then want to display total that i have added in the another node
    eg.
    <Detail>
    <xsl:variable name="<b>etotal</b>" select="sum(ns0:pay/ns0:checkList/ns0:check/ns0:deductionList/ns0:adjustment/ns0:amount/ns0:amount)"/>
    </Detail>
    <Trailer>
    <TotalDeductionAmount><xsl:value-of select="<b>$etotal</b>"/>
    </TotalDeductionAmount>
    </Trailer>
    how to do ?
    since the above example the scope of the variable is local and cannot be accessed globally. how to declare a global variable and then assign value to the variable
    or is there any other method to do this in XSLT
    Thanks in advance
    With Regards
    Pradeep N

    Hi,
    Please see below sample code is solving your problem. Global variable can not solve the problem, you need to use templates and call then appropriately.
    -Kavita
    Sample Input
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <Test>23</Test>
    <Test>34</Test>
    <Test>90</Test>
    </root>
    Sample Output
    <?xml version="1.0" encoding="UTF-8"?>
    <Mt_test>
         <Header>"create the header data according to req"</Header>
         <Details>
              <DetailsCol>23</DetailsCol>
         </Details>
         <Details>
              <DetailsCol>34</DetailsCol>
         </Details>
         <Details>
              <DetailsCol>90</DetailsCol>
         </Details>
         <Trailer>
              <TotalSum>147</TotalSum>
         </Trailer>
    </Mt_test>
    XLST:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template match="/">
    <xsl:element name="Mt_test">
    <xsl:element name="Header">"create the header data according to req"</xsl:element>
              <xsl:variable name="checkNext" select="//Test[1]"/>
    <xsl:call-template name="GenerateTest">
    <xsl:with-param name="currNode" select="//Test[1]"></xsl:with-param>
    <xsl:with-param name="Sum" select="0"></xsl:with-param>
    </xsl:call-template>
    </xsl:element>
    </xsl:template>
    <xsl:template name="GenerateTest">
    <xsl:param name="currNode"></xsl:param>
    <xsl:param name="Sum"></xsl:param>
    <xsl:element name="Details">
    <xsl:element name="DetailsCol"><xsl:value-of select="$currNode"></xsl:value-of></xsl:element>
    </xsl:element>
    <xsl:variable name="Sum1" select="$Sum + $currNode"></xsl:variable>
    <xsl:variable name="checkNext" select="$currNode/following-sibling::*[1]"/>
    <xsl:choose>
         <xsl:when test="$checkNext">
    <xsl:call-template name="GenerateTest">
    <xsl:with-param name="currNode" select="$checkNext"></xsl:with-param>
    <xsl:with-param name="Sum" select="$Sum1"></xsl:with-param>
    </xsl:call-template>     
         </xsl:when>
         <xsl:otherwise>
         <xsl:call-template name="GenerateTrailer">
    <xsl:with-param name="currNode" select="chkeckNext"></xsl:with-param>
    <xsl:with-param name="Sum" select="$Sum1 "></xsl:with-param>
    </xsl:call-template>
         </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    <xsl:template name="GenerateTrailer">
    <xsl:param name="currNode"></xsl:param>
    <xsl:param name="Sum"></xsl:param>
    <xsl:element name="Trailer">
    <xsl:element name="TotalSum"><xsl:value-of select="$Sum"></xsl:value-of></xsl:element>
    </xsl:element>
    </xsl:template>
    </xsl:stylesheet>

  • How do you reference a created global variable in a report text field?

    I have created a parameter using the Globaldim statement in a script file. when I reference this parameter in any other script file during the current DIAdem session the value is passed without any issue.  Call the variable parmxyz where I assign it a value of 25.3 
    The help section under Globaldim mentions that global variables can be referenced in all panels, scripts, and dialogue boxes.  When I try to insert a text box on a report page using the @@parmxyz@@ it returns NOVALUE where I expect to see 25.3 (for example).
    When I substitute @@CurrDate@@ I do get the date, so I know the text box is valid.  What am I doing wrong?
    Steve    M 

    Hello Steve!
    It should work the way you did it. But their are some circumstances wich might prevent it:
    You have reseted the global script engine. All variables will be lost.
    You have a Sub with the same name in a command extension script. There is no warning ;-)
    One Test you can make is to put in '@@TypeName(paramxy)@@' as the expression to see the variable type. You can also try a realy unique variable name. The last option is to use ItemInfoGet to get detailed infos about your variable.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • Global Variables in Flash CS4 (AS3) ?

    Hi,
    I  have another problem with my new project and I am looking to get answers for these two question:
    1.) Is there a way to define a global variable which can be accessed inside and movie clip or button? (where do you define it? is it changeable? can you pass it in by reference?)
    2.) If i have my main stage with some actionscript and a movie clip which has also some action script, IN WHICH ORDER does it execute?
    Thank you in advance for any help and tips!

    Thank you this is what i needed I got it to work now!
    But I do still have one last question on this topic.
    This is the Code:
    //this is in a file Actionscript File called glo.as
    package{
         public class glo{
              public static var widthOfSlider:Number = 5;
    // This code is in scene 1 > my_mc
    import glo;
    trace(glo.widthOfSlider);
    //This code is in scene 1 > my_mc > myNext_mc
    import glo;
    var numOfCovers = 6;
    var temp = glo.widthOfSlider;
    trace(glo.widthOfSlider);
    this.addEventListener(Event.ENTER_FRAME, centerB);
    function centerB(event:Event):void{
         for(var i = 0; i < numOfCovers ; i++ ){
              this["cover_btn_"+String(i)].y = 0;
              this["cover_btn_"+String(i)].x = temp;
              temp += this["cover_btn_"+String(i)].width + 5;
         glo.widthOfSlider = temp;
         trace(glo.widthOfSlider);
         this.removeEventListener(Event.ENTER_FRAME, centerB);
    When I run this I get the following output:
    5
    5
    5
    725.45
    725.45
    The first "5" is from the trace(glo.widthOfSlider); in scene 1 > my_mc
    The next two "5"'s are from the trace(glo.widthOfSlider); in scene 1 > my_mc > myNext_mc
    Is there a way so that I can first execute the code in scene 1 > my_mc > myNext_mc before the code in scene 1 > my_mc ?
    I am trying to get 725.45 through the trace(glo.widthOfSlider); in scene 1 > my_mc

Maybe you are looking for