Network-Shared Variable - 1 subscriber / variable?

I have been reading into the NSV Subscriber example that comes with CVI.  My question is: does each variable require 1 subscriber, or can 1 subcriber be used to read multiple NSV?  Better yet, can anyone explain to me how NSV read and write can be done?

Hi hn_sofec,
Each network variable requires its own subscriber, reader, or writer. The CNVCreate... functions accept a reference to the network variable in the form of the networkVariablePathName parameter. Please refer to the CVI Function help for these functions to find further information and links to examples.
Kristen

Similar Messages

  • Network shared variables lose binding

    Hello,
    I am developing an application in LabVIEW that uses network shared variables to transmit data between two PC's on the same subnet. The shared variables work fine when running the VI's in development mode, however, when i build the vi's into an executable I find that they no longer work. Here is what I have found so far:
    I deploy the shared variable library on the publisher machine (also happens to be the development machine) through an invoke node in the executable. NI distributed system manager confirms that this does deploy and indeed updates as it should.
    For the executable on the subscriber PC I created a second shared variable library (same project) with the same shared variables and bound them to the respective shared variables from the first library by selecting enable aliasing, then bind to PSP URL and browsing to the shared variable I wish to bind it to (e.g. \\hallnet-ellm2\shared variable library\serial Number). The machines listed under browse were listed by name so when I tried this initially and it did not work I manually changed the name of my machine in the URL box to the IP address of the publisher hoping that would fix it in case the subscriber could not resolve the publishers machine alias. So now my bind URL read \\192.168.0.1\shared variable library\serial Number.
    As part of the executable on the subscriber I deploy this second shared variable library. NI distributed system manager confirms that this deploys but under quality for an individual variable it has a list of issues (see attached) and the bound variable is not updating. At this point the publisher shared variables are still functioning fine. By clicking on 'edit variable' I can see that the variable on the subscriber is still bound but the PSP URL is now \\localhost\shared variable library\serial number. Changing the PSP URL on the subscriber to \\192.168.0.1\shared variable library\serial number enables the variable to update as expected.However by this time my executable has already picked up the error and does not function.
    I think that the issue lies with the bind URL used on the subscriber as for some reason it does not keep the binding configured in the project and instead changes to 'localhost'. Why is this? Should it not stay bound to the address specified in the project?
    I have tried changing the IP addresses in the aliases file so that
    [My Computer]
    My Computer=localhost 
    becomes
    [My Computer]
    My Computer=ip of local machine
    This did not help.
    The shared variable libraries are included in the build spec to go into the support files directory and they are successfully deployed from there on both publisher and subscriber.
    I am using LabVIEW 8.6 on Windows XP
    Thanks for any help you may be able to offer,
    Lee
    Attachments:
    distributed system manager.JPG ‏74 KB

    Hi Lee,
    I hope you are well.  Thank you for your post.  Your application sounds very interesting.
    Looking at your issue I was wondering, have you tried lowering your firewalls, as this may be causing the problem.
    Also, another option would be to setup a private network.  Do you have access to any routers that you could use to link the two machines independent of your IT's infrastructure?
    The other thing to try is two other computers entirely.  Again, it would be ideal to take them off the network you are on, but it's something to try if my prior suggestion doesn't work.  It should work on the original two machines though, and it's likely that different computers won't solve your problems because I suspect the network.
    Remember that the client variables must know the location of the variables on the server, so you can't move the server exe around without changing this value.
    Make sure to set the network location in the "Bind to Source" option for the client variables.
    It is also possible to write a separate piece of code to install on every machine that is responsible for deploying the library and by doing so eliminate the need for programmatically deploying the variables in the original application.  However, this won't really help you, because the variables you use in the application have to be the same as the ones deployed in the library, so if you change the library, they'll no longer be linked and they won't receive data.  You'd have to create a separate exe for every binding source you wanted to link to, and then have a second, known library for the sake of communication locally on the computer between the ‘deployer’ and the actual application.  The main application could then be assigned the responsibility of launching the correct ‘deployer’' if it sees it needs to switch to a different variable binding source.  This method is not the most streamlined or effective, but it might work.
    Just to let you know, you will need to use the DSC toolkit.
    Please find below some knowledge base links that I think you will find helpful in your application.
    Using Shared Variables in Executables
    How do I Programmatically Change the Data Binding Source for Shared Variables?
    I hope this information helps and if you can give these suggestions a go and let me know how you get on, that would be great.
    Kind regards,
    Prashant M
    Applications Engineer
    NI UK & Ireland

  • Inconsiste​nt Network Shared Variables

    I will eventually be implementing a controls program on a machine using cfp. Before the cfp gets here, I am getting practice in network shared variables by trying to pass shared variables between two VIs on my computer. I have attached the two VIs and a screen shot of my project. I run a queued state machine and after the initialization routine is done, I run the control portion of the program. The control program is titled 'The4Mprocedure2.vi' and the QSM is titled '4M_QueueDrivenStateMachine'. In the initialization routine of the QSM, 'FALSE' is written to the boolean network shared variable, 'Run_4M_Procedure'. After the initialization routine is done, and a set of certain parameters are met, the QSM writes the value 'TRUE' to 'Run_4M_Procedure'. Ideally, The4Mprocedure2.vi would read the shared variable, and when the value is 'TRUE' The4Mprocedure2.vi would run. The4Mprocedure2.vi has a case statement that causes to run the program when 'Run_4M_Procedure' = TRUE. The4Mprocedure2.vi does not run when the variable is FALSE.
    The problem that I am having is that The4Mprocedure2.vi does not always recognize that the value of my shared variable has changed. When the QSM passes the value of 'TRUE' to the controls program, The4Mprocedure2.vi will sometimes still read the network shared variable as FALSE. Sometimes, I have to restart the controls program several times while the QSM is running to ensure that 'TRUE' is passed to the controls portion. Why does my controls program not recognize when the network shared variable changes values?
    Message Edited by tquintana55 on 07-14-2008 11:04 AM
    Attachments:
    The4MProcedure21.vi ‏87 KB
    ProjectScreenShot1.JPG ‏68 KB
    4M_QueueDrivenStateMachine1.vi ‏131 KB

    Hi tquintana55,
    I believe your Issue is related to the methods that LabVIEW subscribes to the shared variables. Here is a link to a related article:
    How to Avoid the "0" Value at First Read of a Shared Variable in LabVIEW 8.5.x?
    To resolve this you can move your Run_4M_Procedure inside the while loop.
    Sappster

  • Distributed application: Networked Shared Variables, Named Services (Raw TCP/IP) or Other?

    Happy New Year NI forums! 
    I am working on a project involving mobile interacting robots. In the future it is likely the application's components may need to run on different PCs (Targets). Note: at this point in time all the components are seperate but all running on the localhost machine. Thinking towards the future I want to pick the 'best' architecture to allow all these components (VIs performing various functions) in multiple locations. For example, several VIs on the Robots, VIs on serveral PCs. 
    I am  currently aware of using Server/Client TCP/IP using named services. My mock up works well, but is it time efficient (my time coding) I wonder.. ?  
    Whereas I am aware of networked shared variables which handle connections and all the parsing for the underlying tcp/ip communication. But will this be difficult the manage? I am unsure if I can associate shared variables with a VI similar to named services. I suppose I could pro grammatically create the variable upon initialization of the server component - and the client could just search the list of avaiaible variables to connect too. Downside this would require DSC module. 
    As you can see, I am rather unsure. Any advice would be great!
    Kind Regards,
    James  
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!

    Hi Jason,
    Thanks for your reply. I hope your enjoying NI UK as much as I did.. fun times!
    I have seen the link you posted a few times before. But today, I took a better look at it.
    My issue is I need several multi-client severs, i.e. many servers which allow multiple clients to connect to them.
    Now the STM does have an example of this - STM mutli-client Example - Server.vi (used with the STM mutli-client.vi)
    However, when a make copies of these code (to have my second server) - it refuses to run. As in , it just stops itself.
    I DID change the port number, on the lister aspect of the server code. But I Am unsure what else I would need to change to get this setup to work?
    One thought I had was, the FIFOs all having the same name - this probably isn't a good idea between servers.
    Any suggestions would be grateful!
    *please could you provide me email support
    Kind Regards,
    James Hillman  
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!

  • RT Network Shared Variable and Visa Serial Instr class

    Hi,
    I'm using Labview 2009 SP1 with the RT module. I've had no problems creating a RT Target application and a Host PC application which are interconnected using Network Shared Variables, until I came to the COM ports fitted to the RT Target (PXI Embedded Controller and 2 x 4 port COM cards).
    I can configure and use the COM ports in the RT Target application providing I use constants to define which COM port to use, i.e. VISA OPEN function accepts hardcoded "COM2" , (VISA Serial Instr class).
    But I want to pass the COM Port resource name from my host application. 
    Is there a suitable Network Shared Variable I can create ? or how do I change the string value (COM Port name) of the VISA Serial Instr class variable in the RT Target application ?
    thanks,
    Gary.

    Hi there Gary,
    Thanks fot the post. I think I have found something that may be if use to yourself.
    http://labviewwiki.org/Functional_global_variable
    This is the functional global variable.
    Take a look at it and let me know what you think!
    Many thanks,
    Liam A.
    National Instruments
    Applications Engineer

  • Network Shared Variable: Aliasing not working

    Hello!
    I am running a cRIO 9075, which is publishing network shared variables.
    I can see and modify them within Distributed System Manager.
    Unfortunately I am not able to read/write the variables through labview.
    What I have done so far:
    Tools -> Shared Variable -> Register Computer, using the IP of the cRIO
    Adding a Variable to the project. Type = Network-Published, Enable Aliasing, choosing "Browse" to select the variable (all published variables from cRIO are shown there), Access Type = read/write. The PSP-URL is: \\192.168.10.70\WaveformManager\Op
    Trying to read the variable results code -1950679034 and the result is always the default value for that data type.
    BUT this works: using the VIs Data Communication / Shared Variable / Read/Write Variable  and typing in the same URL the Distributed System Manager is showing is showing (in my case: \\192.168.10.70\WaveformManager\Op)
    So, what am I doing wrong? Did I forget something or misunderstand how "Aliasing" works?
    Thanks!

    hi,
    in which way to you read your shared variable? If you read it before you write  a value "into" the variable it may couse this waring.
    Have you tried this?
    http://digital.ni.com/public.nsf/allkb/7DBC2C3E95AFD85C86257442005CF74C?OpenDocument

  • Network shared variables reconnecting network dropout

    I've got a cRIO unit communicating with a Laptop using Network Shared Variables, with one of them being a 21 index array that is buffered.
    The system connects and communicates fine, but occassionally the wireless card in the laptop is losing the signal from the WAP attached to the cRIO.
    When this happens the Network Shared Variables never "reconnect" and start receiving values again once the Wireless link is restored.  Is this an expected behavior?
    When I tried using another industrial WAP instead of the laptop wireless card I do not get the drop-outs.
    Ryan Vallieu
    Automation System Architect
    Solved!
    Go to Solution.

    Hello Ryan,
    Thank you for contacting National
    Instruments!  I have looked into the issue you are experiencing and
    wanted to ask you a few more questions.  First of all, do you have a
    time frame in which you allow for the reconnect?  I believe that the
    Shared Variables should regain connection after a short period but it
    will not necessarily be a very quick process.  It may take a few
    minutes for the Shared Variables to reconnect.
    The other
    thing that may be happening is if you have error wires being passed
    through the Shared Variables, it is possible that the error is not
    being cleared and so it will always see the error and therefore never
    reconnect.  In this case you will have to filter this error out and
    then clear the error in order to utilize the shared variables again.
     If
    you have any more specific information about your program that may help
    us determine the reason for this behavior.  Also a screenshot of your
    code would also be helpful.  Please let me know if you have any further
    questions and I will be happy to assist you.  I hope this helps!
    Thanks!
    Bob H
    Applications Engineer
    National Instruments

  • Network Shared Variable Description

    Hi,
    I've created alot of Network Shared Variables through Project Explorer...and i have also added a description for each one in the shared variable properties screen
    Could someone please tell me how i can get access to the description through LabVIEW?
    Many thanks
    Mike

    Hi attached is a sample of code in which i am viewing a value and also its description.
    Ideally id just like to have the channel name once and the description and value be taken off that, rather than if i ever change it , then have to change the input to the description and also the variable displaying the value. Hope that makes sense
    Regards
    Mike
    Attachments:
    opctest3Kep for forum.vi ‏19 KB

  • Network-Shared Variable - read string with CVI

    I need to read an NSV string with CVI.  I have been digging into accessing and writing NSV with CVI, but they are all scalar value.  What should I do with strings, clusters and arrays?

    'm an employee at National Instruments and I wanted to make sure you didn't miss the Network Variable API that is provided with LabWindows/CVI, the National Instruments C development environment. The the Network Variable API will allow you to easily communicate with the LabVIEW program over Shared Variables (http://zone.ni.com/devzone/cda/tut/p/id/4679). While reading these links, note that a Network Variable and a Shared Variable are the same thing - the different names are unfortunate...
    The nice thing about the Network Variable API is that it allows easy interoperability with LabVIEW, it provides a strongly typed communication mechanism, and it provides a callback model for notification when the Network/Shared variable's properties (such as value) change.
    You can obtain this API by installing LabWindows/CVI, but it is not necessary to use the LabWindows/CVI environment. The header file is available at C:\Program Files\National Instruments\CVI2010\include\cvinetv.h, and the .lib file located at C:\Program Files\National Instruments\CVI2010\extlib\msvc\cvinetv.lib can be linked in with whatever C development tools you are using.
    Thomas N.
    Applications Engineer
    National Instruments

  • Need help getting networked shared variables on compact fieldpoint to work

    I'm still a newbie and am trying to get Networked Shared Variables to pass from a VI running on a PC to a VI running on a Compact Fieldpoint. I created a VI that sends a message via a Networked Shared Variable and a VI that receives it. I have them both in the same project. If I run them both on the PC, it works, I can send a message string from the first VI to the Networked Shared Variable and read it in the second VI. I have the second VI turn the LED "A" on and the LED "B" off if I send the string "a", and turn the LED "B" on and the LED "A" off if I send the string "b", and turn them both off if I send anything else. It works as expected if both the VIs are running on the PC. The second VI also continuously blinks the LED "C" so I can verify that it's running.
    I "deployed" the second VI to the Compact Fieldpoint as follows:
    In Project I dragged the VI from My Computer (under Project: name.lvproj) down and put it under the Compact Fieldpoint name.
    I right clicked on Compact Fieldpoint name and verified it was set to "Connect".
    I right clicked on the second VI and selected "Deploy".
    I started both VIs with the "Run" arrow. At this point I know second VI is running since the LED "C" keeps blinking. But, when I try to send an "a" or "b" nothing happens, so the VI on the Compact Fieldpoint must not be receiving the messages in the Networked Shared Variable.
    I also right clicked on Compact Fieldpoint name and selected
    "Disconnect". The second VI continued to run since the LED "C" keeps
    blinking, but I still can't get messages to pass.
    Any help will be greatly appreciated.

    I got this to work. I moved the library (.lvlib) containing the Networked Shared Variable to down under the Compact Fieldpoint name. Now it works.

  • Error during launching executable with network shared variables

    Hi,
    I am launching an executable which deploys network shared variables before running the application, I am getting the follow error. can someone tell me whats going on.
    thanks,
    Attachments:
    Untitled.png ‏28 KB

    Mudda, 
    Is LabVIEW 2010 installed on the PXI chassis or was this program developed on a different computer?
    If LabVIEW 2010 was installed on a different computer you may need the 2010 runtime engine on the controller. If the development environment is installed on the PXI controller then you should be fine. 
    How are you connecting to the PXI chassis is it on the network or do you have it directly connected to your development computer?
    If you look at this forum the same error occured when another device on the network was sharing the same IP address. 
    http://forums.ni.com/t5/Real-Time-Measurement-and/Deployment-Completed-With-Errors-Network-Shared-Va...
    Could you try plugging the PXI chassis in directly and see if that resolves the issue or changing the IP address?
    Kyle Hartley
    RIO Product Support Engineer
    National Instruments

  • Trying to move a list of form variables to session variables of the same name

    I am trying to move a list of form variables to session variables of the same name and I am having a lot of trouble.
    I have never had to post of this forum with a language question in all the 10 years I have been using ColdFusion. I was a qa Engineer @ Allaire/Macromedia back when it was going from one to the other. I have a pretty good grasp of the language.
    I have software that runs off a list. The fieldnames are variable and stored off in an array. It's survey software that runs off a "meta file". In this example; I have the number of fields in the survey set to 12 in the "metafile". I have each field declared in that file in array Session.SurveyField[1] and the above loop works fine. I include this "metafile" at the start of the process.
    I cfloop around a struct and it works wherever I have needed to use it; such as here - writing to the database for example;
    <CFQUERY NAME="InsertRec" DATASOURCE="Survey">
    INSERT into #variables.SurveyTableName#
    (EntryTime
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    ,#Session.SurveyField[arrayindex]#
    </cfloop>
    <!--- EXAMPLE OF WHAT THE ABOVE GENERATES
    ,q01_name,q02_AcadTechORNA,q03_Water,q04_FirstAid,q05_CPR,q06_LifeGuard,q07_AED
    ,q08_ProjAdv,q09_Color,q10_SantaClaus,q11_Supervisor,q12_SupervisorOpinion --->
       VALUES
        ('#EntryTime#'
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thisname = "Session." & Session.SurveyField[arrayindex]>
    ,'#evaluate(variables.thisname)#'
    </cfloop>
    <!--- EXAMPLE OF WHAT THE ABOVE GENERATES
    ,'#Session.q01_name#','#Session.q02_AcadTechORNA#','#Session.q03_Water#','#Session.q04_Fi rstAid#'
    ,'#Session.q05_CPR#','#Session.q06_LifeGuard#','#Session.q07_AED#','#Session.q08_ProjAdv# ',
    ,'#Session.q09_Color#','#Session.q10_SantaClaus#','#Session.q11_Supervisor#','#Session.q1 2_SupervisorOpinion#' --->
    </CFQUERY>
    NOW HERE'S THE PROBLEM: I am running into trouble when trying to move the form variables to session variables of the same name. It is the only part of the software that I still need the datanames hard coded and that is a roadblock for me.
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thissessionfield = "Session." & Session.SurveyField[arrayindex]>
    <cfset thisformfield = "Form." & Session.SurveyField[arrayindex]>
    <cfset #thissessionfield# = #evaluate(thisformfield)#>
    </cfloop>
    I have tried it with or without the "evaluate"; same result. It doesn't give an error; it just ignores them (session variables look as such in the next page in the chain)
    q01_name=
    q02_acadtechorna=
    q03_water=
    q04_firstaid=
    q05_cpr=
    q06_lifeguard=
    q07_aed=
    q08_projadv=
    q09_color=
    q10_santaclaus=
    q11_supervisor=
    q12_supervisoropinion=
    Note: they exist because I CFPARAM them in a loop like the above at the start of the procedure) - and this works just fine!
    <cflock scope="Session" type="EXCLUSIVE" timeout="30">
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset dataname = "Session." & Session.SurveyField[arrayindex]>
    <cfparam name="#variables.dataname#" default="">
    </cfloop>
    </cflock>
    I EVEN tried exploiting the Form.Fieldnames list using CFLoop over the list and the same sort of logic within and it still gives me nothing....
    Here's the FORM.FIELDNAMES value
    "Q01_NAME,Q02_ACADTECHORNA,Q03_WATER,Q04_FIRSTAID,Q05_CPR,Q06_LIFEGUARD,Q07_AED,Q08_PROJAD V,Q09_COLOR,
    Q10_SANTACLAUS,Q11_SUPERVISOR,Q12_SUPERVISOROPINION"
    Here's the logic; SAME RESULT - The session variables don't get set.
    <cfoutput>
    <cfloop list="#Form.FieldNames#" index="thisfield">
    <!--- <br>#thisfield# --->
    <cfscript>
    thisSESSIONfield = "Session." & thisfield;
    thisFORMfield = "Form." & thisfield;
    #thisSESSIONfield# = #thisFORMfield#;
    </cfscript>
    </cfloop>
    </cfoutput>
    The CFPARAM in a loop with variable output name works just fine; so does the post (which I included above) as does the SQL Create, Param Form Variables, Param Session Variables, etc.
    THIS even works for moving BLANK to each session variable, to zero them all out at the end of the process;
    <cflock scope="Session" type="EXCLUSIVE" timeout="30">
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thislocalfield = Session.SurveyField[arrayindex]>
    <cfscript>
    thissessionfield = "Session." & thislocalfield;
    </cfscript>
    <cfset #thissessionfield# = "">
    </cfloop>
    </cflock>
    Expanding on that code, you would think this would work, but it doesn't;
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thislocalfield = Session.SurveyField[arrayindex]>
    <cfscript>
    thissessionfield = "Session." & thislocalfield;
    thisformfield = "Form." & thislocalfield;
    </cfscript>
    <!--- debug --->
    <!--- <cfoutput>#thissessionfield# = "#evaluate(thisformfield)#"</cfoutput><br> --->
    <cfoutput>
    <cfset #thissessionfield# = "#evaluate(thisformfield)#">
    </cfoutput>
    </cfloop>
    And see that debug code in the middle? To add insult to injury... When I uncomment that it shows me this. So it certainly looks like this should work....
    Session.q01_name = "Me"
    Session.q02_AcadTechORNA = "N/A"
    Session.q03_Water = "Yes (certificate expired)"
    Session.q04_FirstAid = "Yes (certificate is current)"
    Session.q05_CPR = "No"
    Session.q06_LifeGuard = "Yes (certificate expired)"
    Session.q07_AED = "Yes (certificate expired)"
    Session.q08_ProjAdv = "Yes (certificate expired)"
    Session.q09_Color = "Gray"
    Session.q10_SantaClaus = "Yes"
    Session.q11_Supervisor = "Da Boss"
    Session.q12_SupervisorOpinion = "Not a bad thing"
    There must be some simpler way to do this. This way won't work against all odds even though it seems so much like it should.
    So I end up having to hardcode it; still looking for an automated way to set these #@%$*@!## session variables over the list from the form variables of the same @#@!$#%$%# name. Do I sound frustrated???
    No matter what I do, if I don't HARDCODE like this;
    <cfset Session.q01_name = Form.q01_name>
    <cfset Session.q02_AcadTechORNA = Form.q02_AcadTechORNA>
    <cfset Session.q03_Water = Form.q03_Water>
    <cfset Session.q04_FirstAid = Form.q04_FirstAid>
    <cfset Session.q05_CPR = Form.q05_CPR>
    <cfset Session.q06_LifeGuard = Form.q06_LifeGuard>
    <cfset Session.q07_AED = Form.q07_AED>
    <cfset Session.q08_ProjAdv = Form.q08_ProjAdv>
    <cfset Session.q09_Color = Form.q09_Color>
    <cfset Session.q10_SantaClaus = Form.q10_SantaClaus>
    <cfset Session.q11_Supervisor = Form.q11_Supervisor>
    <cfset Session.q12_SupervisorOpinion = Form.q12_SupervisorOpinion>
    I always get this from my next page because the session variables are empty;
    You must answer question 1.
    You must answer question 2.
    You must answer question 3.
    You must answer question 4.
    You must answer question 5.
    You must answer question 6.
    You must answer question 7.
    You must answer question 8.
    You must answer question 9.
    You must answer question 10.
    I tried duplicate as well, but I can not get the above to work...
    Can anyone help me do this thing that one would think is simple????

    I think if you use structure array syntax you should get the results you want.
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
          <cfset session[Session.SurveyField[arrayindex]] = Form[Session.SurveyField[arrayindex]]>
    </cfloop>
    Or probably even easier.
    <cfset session = duplicate(form)>

  • Default initialisation of member variables and local variables

    I don't understand why member variables are initialized with default values by Java.
    Objects are initialized with "null" and primitives with "0", except boolean, which is initialized with "false".
    If these variables are used locally they are not initialized. The compiler requires them to be initialized by the programer, for example "String s = null".
    Why? What is the use of that difference?
    And why are arrays always initialized with default values, no matter if they are member variables or local variables? For example String[] s = new String[10]; s[0] to s[9] are initialized with "null", no matter if "s" is a local or member variable.
    Can someone please explain that strange difference, why it is used? To me it has no sense.

    Most of the time I have to initialize a local variable
    with "String s = null" in order to use it because
    otherwise the compile would complain. This is a cheap
    little trick, but I think everyone uses it.
    I wouldn't agree with "most of the time". The only cases where it is almost necessary to do that is when the variable should be initialized in a loop or a try-catch statement, and that doesn't happen too often.
    If local variables were initiliazed automatically without a warning it would be a Bad Thing: the compiler could tell when there is a possibility that a variable hasn't been assigned to and prevent manymanymany NullPointerExceptions on run time.
    And you didn't answer me why this principle is not
    used with arrays if it is so useful as you think.
    Possibly it is much more difficult to analyse the situation in the case of arrays; what if values are assigned to the elements in an order that depends on run time properties such as values returned from a random number generator.
    The more special rules one has to remember, the more
    likely one makes errors.I agree, but what is the rule to remember in this case?

  • Replacement Path Variable with Another Variable

    Hi,
    I am currently trying to create a report that would need me to have the same values for different characteristics (e.g. clearing date, posting date, net due date). I have seen that there is a way in the replacement path variable that would replace its value with another variable that is ready for input. I also looked into SAP help but I can't seem to figure out on how to do it specifically. Does anyone know a step-by-step process on how to do this? How does this work?
    Thank you in advance!

    take an e.g.
    u have characteristic say ch1
    u want to restrict it with replacement path variable
    first of all create a variable var1
    click what it is based upon for e.g. 0calday, 0material etc.
    make it user entry variable
    select single or multiple entry
    make it mandatory
    save it and hit okey
    click on ch1
    right click and say restrict
    in new window create a new variable
    give its name and technical name
    processing path is replacement path
    go to next tab of replacement path
    select several ooptions
    replace variable with another variable
    select a variable called var1
    change the offset length and offset start with different parameters.
    hit okey
    this way u have restricted ch1 with replacement path variable var1
    now when u run report u have to enter value of var1
    which will then further feeded to ch1
    this way u can create replacement path variables at lots of instances and then u can always feed the value from var1 at different time
    make sure as this ur requirement is date
    try to use 0calday as reference infoobject all the times....

  • Using a variable inside another variable

    I'm trying to use one two variable in a package with one variable feeding its value to another variable as follows:
    Variable 1 = Count
    Variable 2 = File_Name
    Variable 1 counts up from 1;I would like to use this value as an input to Variable 2 as follows:
    SELECT LOAD_FILENAME FROM DIMSTATS_FILENAME WHERE (SELECT ROW_NUMBER() OVER (Order by FILE_ID) AS RN FROM DIMSTATS_FILENAME) = #DIMSTATS_TEST.count.
    How ever I am getting the following Error :
    +ODI-1228: Task File_Name (Variable) fails on the target  connection DDBSTAGE.
    Caused By: java.sql.SQLException: [FMWGEN][SQLServer JDBC Driver][SQLServer]The multi-part identifier "#DIMSTATS_TEST.count" could not be bound.+
    I have also noticed that the value of Variable 1 is not being passed to the Select statement above through SQLServer Profiler. If I hard-code the value of #DIMSTATS_TEST.count (Variable1) the query is successful.
    How can I get the value of Variable 1 to be passed to Variable 2?
    Could someone please help
    Thanks

    You did not mentioned how you are using those variable .
    You need to have these variable inside a package .
    It will be like
    Variable 1 (Refresh) -------OK-------->Variable 2(Refresh) ------------OK-----> Some other operation .
    Thanks,
    Sutirtha

Maybe you are looking for

  • How to an on screen dialogue box?

    How to an on screen dialogue box?

  • Help! Message app deleted can't access it atall?

    My message app has gone and my camera and facebook. It won't let me take pictures and everytime I click on a message it comes up with file://.com.apple.MobileSMS/SMSSearch/message_guid=C41BEAB7-CD7F-4AF9-9F88-9DF4 E904BAA3&query=messa I'm wondering i

  • SAP Support for Windows 2008 R2 SP1

    How can I find out if SAP supports Windows 2008 R2 SP1? We have ECC6 enh4 running on Win2008R2 servers, our admin would like to apply SP1 to these.  I'm trying to find documentation to verify SAP Supports SP1.  So far I've come up empty. Thanks

  • Restoring old white imac

    i'm giving my Mom my old white 'bubble' computer and put in the restore cd's--there were three of them and then put in the OSX install which I remember came with the computer when we bought it in 02--but when everyting was reinstalled there was no ip

  • ESS not available in SPRO

    Hello, I have configured ESS in developement and QA, but when I was going to make sure everything was fine in production I can't find the SPRO entries inside personnel management. The same thing happens with the SAP Learning Solution....SPRO entries