Store Counter Number in BODS using Global/Local Variable

Hi All,
Anyone done before adding a counter integer field into a table based on key via BODS?
Example:
Table 1 (contains just 1 field) <-Input:
Key 1
Key 1
Key 2
Key 2
Key 2
Table 2(contains 2 fields with INT as the 2nd field) <-Output:
Key 1      1
Key 1      2
Key 2      1
Key 2      2
Key 2      3
I was wondering if populating the Local Variable or Global Variable might work but from my understanding, inside the Data Flow , it's not possible to increase the variable value ($count = $count + 1).

Hi Maurice,
Thats a good idea!!
I had currently implemented a solution where i use Variables and Customize Functions to solve the problem.
Will give a try and see if your solution produce the same result.
Tim

Similar Messages

  • No difference between using a local variable and a notifier in timed parallel loops?

    The example code "Pass Data With Notifiers.vi" that came with LV 7.1 illustrates using notifiers with parallel loops.  Just looking at two of the loops, the one that generates the sine wave and the one for "User 1", you can change the timing of the two loops and you can change the condition of the "Ignore Previous" status on the "Wait on Notification".  I have a special case of this to consider, where I'm wondering if there's any reason not to use a local variable instead of the notifier:
    Set the delay on the generator portion (which contains the Send Notification) to something very short, say 5 ms.  Set the delay on the User 1 (which contains the Wait on Notification) to something relatively longer, say 200 ms.  Set the Wait on Notification to False.  Now you have a situation where the User 1 loop action is contingent only upon the loop delay time, since each time the loop timer runs the loop there will always be a value in the notifier.  In this case it seems to behave just like the case where you update a local variable in the fast loop and read it in the slow one.
    Is my understanding correct?  Would there be a performance difference between the two methods?  What do you prefer in this situation and why?
    Thanks,
    Hosehead

    Hi H.,
    I think your idea is to write to a Global Variable in the data-producer VI, and read it in the data-consumer VI(?)
    One reason this might be less efficient than using Notifiers is if you want to graph every new value in the "consumer" - or make sure the value read in the consumer has changed at least once since the last loop.
    > since each time the [consumer] loop timer runs the loop there will always be a value in the notifier...
    > Would there be a performance difference between the two methods? 
    If you don't use the Notification "event" to synchronize the producer and consumer, then to be sure the consumer gets a new vaue, you've made the producer loop faster - every 5 ms - a waste of cpu-cycles.  More often the situation is reversed, that is, there's a consumer that needs to see every single new value, and (without events) the consumer must loop faster than the producer (to catch every new value) - this is called polling and it wastes cpu-cycles.
    Just about anytime one's tempted to make a loop execute "fast" to check on some value (or to make sure there's a fresh value,) there's an opportunity to improve performance through synchronization with events (including notifiers, queues, occurrances, semaphores, and rendezvous')
    tbd
    Message Edited by tbd on 07-09-2006 03:51 AM
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • How to count number of edges using PXIe-6363 Counters

    Hello,
    I am trying to count number of edges in a test signal in a 50 ms duration. I am using PXIe-6363 card and connecting the test signal to CTR 0 SRC (PFI 8). Is it a correct connection? What else do I need hardware-wise to make a correct set up for this application?
    Thanks
    Jeet
    Solved!
    Go to Solution.

    Hi Jeet,
    When you say interrupt signal, do you mean a pulse that will pause your counter task? If that is the case, and you want to pause your task with a digital pulse, you need to use the DAQmx Trigger Property Node and set that to Pause, Trigger Type. As you said, you can connect that signal coming from the chip to any PFI line and then set that line as the source of the property node.
    There is an example that you can use that does exactly what I just described. This example is called Count Digital Events-Pause Trig.vi, and you can find it by going to Help>Find Examples..., then on the NI Example Finder window go to the Browse tab and navigate in the folders to Hardware Input and Outpout\DAQmx\Counter Measurements\Count Digital Events.
    Regards.
    Jorge
    Applications Engineer
    National Instruments
    Certified LabVIEW Associate Developer (CLAD)

  • Global, local variables in SubVI's

    Hi,
    I'm having a problem with what is probably a 'feature' of labview
    (using ver 6.1).
    When running multiple SubVI's of the same type, any local variables
    declared within the SubVI are globally scoped across all instances of
    that SubVI within one VI. Is there any way to prevent this?
    I am trying to store the Status of the SubVI in a local, but obviously
    each instance of the SubVI ends up with the same status. Currently i
    have solved this by having exact copies of the SubVI for each
    instance, but obviuosly as far as labview is concerned they are now
    different SubVI's, i consider this a bit of a hack and would rather
    avoid it.
    Any pointers?
    Many Thanks,
    Ed

    If you make the sub-VI reentrant, you will get the type of local you're looking for. On the sub-VI's menus, goto File >> VI Properties >> Category >> Execution >> Reentrant Execution.

  • How to: Transform Activity: Read global/local variable, execute java code

    Could anyone please show me how to do that???

    could you please elaborate your usecase? yes you can read global variable using getVariableData( ) xpath function and pass them as an argument to the processXSLT ( ) xpath function.
    You can read the global or local variables inside java exec using, please refer samples/references/javaexec sample.

  • Is it possible to use Global class variable in a  BAdi

    Hello Experts,
      I have a requirement wherein ,
             I need the Reference of the Class Object to be used in a BAdi. The class object is defined as a global variable.
    By any means can I use the reference variable inside the BAdi.
    thanks

    Hi Hari,
    U can access any objects or variables in BADI only if they are used as parameters in it.
    So please check whether that global object is declared as parameters in the corresponding BADI.
    If so, you can surely use it.
    Reward points if this is useful.
    Regards,
    kamalapriya

  • I want to fill and empty a tank automatically can this be achieved without the use of local variables?

    Gurus of Labview,
    I have a Project to complete and i am new to labview, I have student version 2009. and want to build an initial vi of a Municipal water trteatment plant TO FILL AND EMPTY TANKS. I am using the DSC module to help and I can get my tanks to complete a sequence, however it uses local variables. They cannot be shared on the network when I create my libraries.  Need help urgently..
    Casey74
    Solved!
    Go to Solution.

    Casey74 wrote: 
    Here is the block diagram for your enjoyment.......
    Sorry, I cannot "enjoy" an image. It would help much more to see the actual VI.
    LabVIEW Champion . Do more with less code and in less time .

  • How to count number of vehicles using image processing tools in LabVIEW

    anyone can give me idea that how to do counting of vehicles using image processing tools

    Hello,
    if camera is stationary, first take an image of the background. Then subtract each acquired image from the reference image. Limit the region of interest - build a mask of the area, where you want to detect vehicles. Use only the pixels that are under the mask for further processing. You probably would need to do some morphological operations (for example dilate) to make the detection more noise-free...
    Maybe you could get more reference images (different time of day) and compare the average intensities of the acquired and the reference image to select the best image for subtraction.
    You could then probably just count the numer of objects to get the number of vehicles.
    You can perhaps also use optical flow to track the vehicles, but you would need to compute some features for example strong corners for each vehicle (check good features to track, http://docs.opencv.org/modules/imgproc/doc/feature_detection.html). Or you can use the new mean-shift tracking library (Labview 2013).
    Hope this helps a bit.
    Best regards,
    K
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."

  • How we are using Global, Local and Document Currencies  in DAC.

    Hi All,
    How we can configure Local,Global and Document currencies for GL Load.
    and where we can use these parameters in informatica.
    What does stand for PLP and what is logic behind PLP.
    Thanks in advance
    Thanks,
    Bhavik

    Currencies are discussed in the Setup and Configuration Guide here:
    7.1.1.2 How to Configure Global Currencies
    To configure the global currencies you want to report in your warehouse:
    In the DAC Client, display the Design view.
    For more information about logging into the DAC, see Section A.1, "How to Log Into the DAC Client".
    Select a container from the drop down list to the right of the Execute button.
    Display the 'Source System Parameters' tab.
    Locate the following parameters and set the currency code values for them in the 'Value' box:
    $$GLOBAL1_CURR_CODE (for the document currency).
    $$GLOBAL2_CURR_CODE (for the local currency).
    $$GLOBAL3_CURR_CODE (for the global currency).
    Make sure that you spell the currencies as they are spelled in your source OLTP system.
    Save your changes.
    As far as for PLP items, those are Post Load Processing elements that perform cleanup tasks after the Base Warehouse tables have been loaded. They should never be modified and frankly run without any issues provided the rest of the plan executes properly. Do you have a specific quesiton about a PLP?

  • Counting number of records using where clause in a large table

    SQL SERVER 2008
    I've to find the count of the rows matching some conditions. The table size is very large with around 50 columns. And every day around 3000 rows are adding. 
    My business logic is to count the number of payments made by a particular user, also if the count exceeds 10 then the user is GoldUser else NormalUser.
    here:
    select count(payment_id) from payments_master_table where payment_user = @payment_user;
    here payment_id is primary key. This query is very slow, since it has to scan the whole table. Is there any other optimized way to find the number of counts. 
    Also, one way I can do is, if the count of payment_id exceeds 10, stop the count,
    but I do not how to do this.  
    Please can anyone help me. 
    Thanks!

    not top 10, but suppose 
    if the count(payment_id) reached 10 for a particular user before scanning the whole
    table, why to proceed ahead. My condition is to apply any user as GoldUser if the count is 10 or more than that. So stop the count if it reaches 10.
    Then in that case you need to implement it as a correlated query
    ie like
    SELECT t.User,COUNT(*)
    FROM table t
    CROSS APPLY (SELECT TOP 10 payment_id
    FROM table
    WHERE payment_user = t.payment_user
    )t1
    GROUP BY t.User
    It will try to fetch random 10 rows for the user and then get count. But even in this case you cant tell it will stop at exactly 10 record for every user as it depends on few other factors too.
    In any case the index on the payment_user column will really help
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to find out where I have used a certain Global/Local Variable

    Hi Friends
    I want to track how and where the shared variable's  value has been
    changed/Read when I try to debug the program. Anyone
    here had the expenrience on how to find a certain shared variable in
    the Block Diagrams/VIs. I will very appreciate you help.
    Cheers!

    Hi All
    I have tried the  ctr+F to find a certain shared variabl, but the result came out is looks all the shared varibales. How can I focus on 1 certain shared variable. I am using labview8.2.1.
    And I have tried the Find shared variables VI  from the link Ben showed me. It can not work properly. It showed an error when I try to search, which says: Error 1057 as attached. Could anyone tell me why. Thanks.  
    Attachments:
    Error 1057.JPG ‏66 KB

  • Using a local variable in regex portion of replaceAll(regex, replacement)

    While this works..
    output = output.replaceAll("(HED>|AUT>)(.*)(</\\1)", "$1<![CDATA[$2]]>$3");
    I'd like the list of alternation values to be contained in a variable, for example:
    String nodeLIst = "HED>|AUT>";
    output = output.replaceAll("(nodeList)(.*)(</\\1)", "$1<![CDATA[$2]]>$3");
    The extension of this would be so I can store this stuff in a db as a list and avoid compilation on change, but please don't let this muddy the waters... :)
    Any pointers are much appreciated. Links to specific reading material, etc. I've scoured Friedl's Mastering Regular Expressions to no avail. This approach is supported by some other regex engines I've used (perl, php, ORO?) but I'm new to Java.
    TIA,
    Mark

    I've scoured Friedl's Mastering Regular Expressions to no avail.Did you look on page 209? In the book, that code sample is labelled "Building Up a Regex Through Variables in Java". That should have been a clue. ^_^
    But seriously, you're probably thinking of the interpolated strings you find in scripting languages like Perl, PHP, Ruby, etc.. But that's a feature of the language itself, not the regex engine, and Java doesn't work that way. (The $1, $2, etc., in the replacement string are processed by the Matcher class, in a very limited imitation of Perl's variable interpolation).
    However, you can fake it pretty well with String's format() method:   String regex = String.format("(%s)(.*)(</\\1)", theAlternation);
      output = output.replaceAll(regex, "$1<![CDATA[$2]]>$3"); That way, you can easily escape the dynamic part, in case it might contain regex metacharacters:   String regex = String.format("(%s)(.*)(</\\1)", Pattern.quote(theAlternation));

  • How to use globally defined variable in SQ01

    Hi,
    I have created one InfoSet using SQ02. In that I have declared some Additional Fields. These Additional Fields are of type String , so I have declared thses fields in DATA Section of Code of Infoset as it is not possible to define a custom field of type string.
    Now I have to add these fields to Field Groups, so that I can use them in queries (SQ01). 
    Can anyone plz tell me how to add these fields in Field Groups?
    Thanks.
    Edited by: hrishi_k126 on Sep 23, 2010 9:46 AM

    Hello,
    Please, ask this kind of questions in the e-business forum.
    Francois

  • When to use Global transaction and Local Transaction only

    Hi All,
    Could you please help with this question thats been troubling me from quite long time.
    When to create Global & local Transactions and Local Transaction Only while creating Data source on oracle Application Server 10 G.
    Do I get any advantages by using Global & local Transactions for creating Data Source
    Thanks In Advance.
    Regards,
    Ajay Kumar .Akula

    mattyG wrote:
    What is the difference between a single-process shared variable and a local variable?
    A single process shared variable is more like a global variable, because it can be accessed from any VI in your hierarchy. Local variables are strictly local to the single VI where they reside.
    Shared variables are a relatively new feature, while local and global variables are ancient. As such, shared variables are in many ways more modern and integrate better into state-of-the-art coding guidelines.
    Shared variables contain error terminals so you can enforce execution order. local variables have no such thing.
    A shared variable can stand on its own, while a local variable is always tied to a front panel object.
    You need a project for shared varaibles.
    You can easily turn a single process shared variable into a network shared variable later in the development, without the need to rewrite any code.
    LabVIEW Champion . Do more with less code and in less time .

  • Problem using local variable in event loop

    I have a state machine from which I want to monitor various controls, including "Start" and "Stop" buttons.  Not every state needs to monitor the controls.  At present, most states run timed loops.  In the first state that reads the front panel, I have an Event structure (inside a While loop) that monitors the various controls' Change Value events.  For numeric controls, I update variables (in shift registers) as needed.  The "Start" button is used to end the While loop controlling the Event structure, allowing the State to exit to the next state.
    My problem comes in subsequent states that employ this same idea.  Here, I put a Local Variable bound to the Start button and use the same code, but it frequently happens that when I enter this particular state, I cannot "turn on" the control -- I push the button, but it stays off.  Curiously, if it was On when I enter, I can turn it off, but then I'm stuck not being able to turn it on.
    I mocked up a very simply routine that illustrates this.  There are two sequences (corresponding to the two states).  Both use an Event loop with a local variable bound to my Stop button (really this is an LED control with custom colors).  I've deliberately moved the "initialization" (the declaration of the control in the block diagram) out of the Event loops -- putting it inside the first loop modifies the behavior in another strange way.
    Here's my thinking on how I would expect this to work:  The code outside Event Loop 1 should have little effect.  Assume the Stop button is initially Off.  You will "sit" in Event Loop 1 until you push the Stop button, changing its value to True; this value will be passed out of the Event case and cause the first While loop to exit.  You now enter the second sequence.  As I understand the Exit tunnel, it defaults to "False", so I'd expect to stay in the second Event loop until I turn the Stop button from On to Off, which will pass out a False, and keep me in the While for one more button push.  However, this doesn't happen -- I immediately exit, as though the "True" value of the Stop local variable is being seen and recognized by the Event loop (even though it hasn't changed, at least not in the context of this second loop).
    An even more curious thing occurs if I start this routine with the Stop button turned on.  Now I start in my Event loop waiting for a change, but this time the change will be from On to Off, which won't cause an exit from the frame.  This will be reflected by having the While loop count increment.  We should now be in the state of the example above, i.e. in an Event loop waiting for the control to be pushed again, and turned On.  However, clicking the control has no effect -- I cannot get it to "turn on".
    Where am I going astray in my thinking?  What is it about this method of doing things that violates the Labview paradigm?  As far as I can tell, what I'm doing is "legal", and I don't see the flaw in my reasoning, above (of course not -- otherwise I'd have fixed it myself!).  Note that because I'm using local variables inside Event loops (and I'm doing this because there are two places in my code where I want to do such testing), the Stop control is not latching (as required).  Is there something that gets triggered/set when one reads a latched control?  Do I need to do this "manually" using my local variable?
    I'll try to attach the simple VI that illustrates this behavior.
    Bob Schor
    Attachments:
    Simple Stop Conundrum.vi ‏14 KB

    altenbach wrote:
    Ravens Fan wrote:
    NEVER have multiple event structures that share the same events. 
    Actually, that's OK.  NOT OK is having multiple event structures in the same sequence structure.
    See also: http://forums.ni.com/ni/board/message?board.id=170&message.id=278981#M278981
    That's interesting.  I had always thought I read more messages discouraging such a thing rather than saying it was okay.  Your link lead me to another thread with this message. http://forums.ni.com/ni/board/message?board.id=170&message.id=245793#M245793.  Now that thread was mainly concentrating on registered user events which would be a different, but related animal. 
    So if you have 2 event structures they each have their own event queue?  So if you have a common event, one structure pulls it off its event queue and it does not affect the other structure's event queue?  I guess the inherent problem with this particular VI was that the second event structure locked the front panel.  Since the code never got to that 2nd event structure because the  first loop never stopped because the change was from true to false.  After reading your post and the others, I did some experimentation and turned off the Lock front panel on the 2nd structure, and that prevented the lockup of the program.
    Overall, the example VI still shows problems with the architecture and I think your answer should put the original poster on the right track.  I think as a rule I would probably never put the same event in multiple structures, I feel there are better ways to communicate the same event between different parts of a program,  but I learned something by reading your reply and about how the event structures work in the background.  Thanks.

Maybe you are looking for

  • Date filter not reading dates correctly

    I've noticed that since Bridge CS5 came out, the filter on date is not working correctly. For example,I'm looking at a series of images that I captured today (Sept 7th), and the date shown in the metadata panel of Bridge ays "Today". Yet, the Filter

  • Intel 975x and E6600 overclocking?

    I've attempted overclocking but I'm not sure if I'm doing it right. E6600. 1GB RAM. I've got my FSB @ 300 and set FSB & RAM at a 1:1 ratio. The RAM is now running at 533mhz as opposed to 667mhz. My mobo is an Intel 975x and the RAM is DDR2 5300. The

  • Itunes 11 grey in windows 8

    i just got a new computer installed windows 8 and itunes 11 but all my album art is blakc and white and some are color i dont know what is up i installed itunes 4 times anyone could help would be appreciated

  • Problem trying to fix on @REMOVE

    Hi all,I have a calc script I am using to clear data prior to a data load. I want to clear all data for every member of an accounts dimension except for a select few.My fix statement looks like this:FIX(@REMOVE(@RELATIVE("A199999",0),@RELATIVE(Variab

  • I have a MacBook Pro 2007 and I installed Mac OS 10.6 but I lost power in the process and now the mac doesn't recognize my hard drive

    I have a MacBook Pro 2007 and I installed Mac OS 10.6 but I lost power in the process and now the mac doesn't recognize my hard drive, how can I fix this