Programmatically create array from common cluster items inside array of clusters

I have seen many questions and responses on dealing with arrays of clusters, but none that discuss quite what I am looking for. I am trying to programmatically create an array from common cluster items inside array of clusters. I have a working solution but looking for a cleaner approach.  I have an array of clusters representing channels of data.  Each cluster contains a mixture of control data types, i.e.. names, types, range, values, units, etc. The entire cluster is a typedef made up of other typedefs such as the type, range and units and native controls like numeric and boolean. One array is a “block” or module. One cluster is a channel of data. I wrote a small vi to extract all the data with the same units and “pipe” them into another array so that I can process all the data from all the channels of the same units together.  It consists of a loop to iterate through the array, in which there is an unbundle by name and a case structure with a case for each unit.  Within a specific case, there is a build array for that unit and all the other non-relevant shift registers pass through.  As you can see from the attached snapshots, the effort to add an additional unit grows as each non-relevant case must be wired through.  It is important to note that there is no default case.  My question:  Is there a cleaner, more efficient and elegant way to do this?
Thanks in advance!
Solved!
Go to Solution.
Attachments:
NI_Chan units to array_1.png ‏35 KB
NI_Chan units to array_2.png ‏50 KB

nathand wrote:
Your comments made me curious, so I put together a quick test. Maybe there's an error in the code (below as a snippet, and attached as a VI) or maybe it's been fixed in LabVIEW 2013, but I'm consistently getting faster times from the IPE (2-3 ms versus 5-6ms for unbundle/index). See if you get the same results. For fun I flipped the order of the test and got the same results (this is why the snippet and the VI execute the tests in opposite order).
This seems like a poster child for using the IPES!  We can look at the index array + replace subset and recognize that it is in place, but the compiler is not so clever (yet!).  The bundle/unbundle is a well-known "magic pattern" so it should be roughly equivalent to the IPES, with a tiny penalty due to overhead.
Replace only the array operation with an IPES and leave the bundle/unbundle alone and I wager the times will be roughly the same as using the nested IPES.  Maybe even a slight lean toward the magic pattern now if I recall correctly.
If you instantly recognize all combinations which the compiler will optimize and not optimize, or you want to exhaustively benchmark all of your code then pick and choose between the two to avoid the slight overhead.  Otherwise I think the IPES looks better, at best works MUCH better, and at worst works ever-so-slightly worse.  And as a not-so-gentle reminder to all:  if you really care about performance at this level of detail: TURN OFF DEBUGGING!

Similar Messages

  • Data Logging a programmatically created shared variable of cluster or array datatype into citadel DB

    Hi,
    Is there a way to log a programmatically created shared variable of cluster or array datatype into citadel DB?
    I have attempted to programmatically create a shared variable of type 'double' and was able to successfully log the same into Citadel DB. In the attachment, Please refer to the attached project SV_TC.lvproj and specifically to SV_W.vi for the code that i have used (W.png file shows the dB in MAX and shared variable in NI Distributed System Manager)
    However when i tried the same approach to create a shared variable 'array of double', i noticed that traces are not getting created and hence data logging isn't happening into the Citadel DB. I was however able to write and read the shared variable array without issues. The same is true with cluster datatype also. Please refer to SN_NW.vi for the code that i have used - only difference from SV_W.vi is that i have tried to create a shared variable of type 'array of double'
    One observation is that if i create an 'array of double' or cluster in a shared variable library using the project explorer and deploy, i could see that these being logged into Citadel DB.
    Hence i want to understand what could be done to achieve the same programmatically? Could you please advice?
    Regards,
    Sridhar
    Attachments:
    SV_TC.zip ‏3925 KB

    Why is the transaction happening over remote?
    Because we need the information to be on our database immediately when they submit it.
    I don't know anything about streams or replication.....
    The web database is run by the company that hosts our web site. We use PL/SQL to show the pages and output the html. It fetches the data the customer is requesting from our database, but I'm struggling to get the best way to insert into our database from there.

  • Scripting: Create Cluster in Array from existing cluster

    I am creating a custom programming tool to generate some custom LabVIEW TypeDefs.
    One of the structures I have to create is an array of clusters; but from an existing cluster.  That is, I have a reference to a previously defined cluster, and I need to array this.
    One possible way to do this is to duplicate the cluster next to the empty array, and then 'move it into' the array.  This seems to be an ugly solution.
    Is there a better way?  When I try and use "Create from Reference" method, the cluster is created in the array, but the sub-elements trigger error 0x421: Type Mismatch.
    Thanks!
    Jed

    Hi Viper,
    Sorry- you misunderstand.  We are talking about doing this with LV Scripting; what you did statically defines the array type in the VI.  Writing LV code that would create the array from an undefined array by running a VI.  (In the situation above, the code would actually EDIT the VI and change it's functionality)
    There are a few examples in the distro if you search for "scripting", but here's a page with some example code you can look at.
    http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/wiring_scripting_objects/

  • Adding property/field to an item inside array collection

    Hi
    I'm newbie. But I'm spending a huge amout of time trying to figure out something that should be simple.
    in short:
    I wanted to add a new field/property to an item inside an arraycollection(ac).
    I thought something like:
    ac.souce[i].push(object:value)
    would do (its inside a loop, since I have ac.length) but it didnt.
    ITS IMPORTANT TO SAY THAT:
    i think addItem, or addItemAt IS NOT THE CASE.
    I want to add an new item INSIDE the array that is wrapped in ac.
    in long:
    I have a ORDERS table that comes with a client_id (int).
    I need to retrieve the client's name from a CLIENTS table.
    Ok i have to put everything on the same datagrid. So, first i've tried to ivoke a function like this that would use the getClientsByID and return a string with its name.
    It didn't worked, maybe due to the syntax.
    SO, i thought i had to put all those 2 tables into 1 array collection to use this as a 'formated' data provider for the datagrid.
    What should I do? this is a simples example.
    Thanks a lot
    Btp~

    Just borrow code from ListBase.as, don't actually use an instance of ListBase.  That pattern should work for non-display classes as well.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Not able to create DIR from PR line Item

    Dear Friends,
    I have Cretaed Doc Type "CON" and entered "EBAN - Purchase Req. Item" in the object link and in Create Document I have mentioned " 1 - Create simple document".
    When I try to create a DIR from PR Line Item, there is no option or a logo in the Popup  where I can click and create DIR from The Object PR Line Item.
      I get the create Document icon in WBS element for same document type.
    Can anybody guide me the if I have missed any config.
    With Warm Regards
    Mangesh Pande
    Edited by: MANGESH PANDE on May 23, 2011 11:33 AM

    Screen calling is controlled by MM module -
    check
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=68747578
    I dont think its possible to create document from PR

  • How create TO from TR when items are QM relevant?

    I am using function module L_TO_CREATE_TR  to create a TO from a TR for raw materials being GR'd into a raw material warehouse. 
    QM is set up.  If I use function module L_TO_CREATE_TR,  I keep getting error 2 (QM_relevant).  However, if I go through LT04, I would need to go through palletization to  bring up the screen in order to choose the place into stock option before entering the bin into which I am placing stock
    Is there a way of creating a TO from TR where items are QM relevant with some function without resorting to doing a call transation of LT04?
    Any help would be appreciated
    Regards
    Larissa Maryniuk
    Edited by: Larissa Maryniuk on Jan 19, 2010 5:11 PM

    Not been able to do this.  Going down LT04 route

  • Programmatically creating VM from already created image using Java

    Hello.
    I am writing a Java program to create VMs from already created VM images. I was able to create through the web portal.
    I am using the API given here http://msdn.microsoft.com/en-us/library/jj157194.aspx
    The request sent is
    <?xml version="1.0" encoding="UTF-8"?>
    <Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Name>mltestdeploy</Name>
    <DeploymentSlot>Production</DeploymentSlot>
    <Label>ZGVwbG95bWVudF9tbHRlc3RkZXBsb3k=</Label>
    <RoleList>
    <Role>
    <RoleName>mltesthost</RoleName>
      <RoleType>PersistentVMRole</RoleType>
    <VMImageName>ml-centos-image</VMImageName>
    </Role>
    </RoleList>
    </Deployment>
    "ml-centos-name" is an existing image with that name and I have used this to create another VM from this image.
    I have already created the required cloud service as required by this API.
    I am getting error 400 with text as "Bad Request". This means some parameter is wrong.
    Any help is very much appreciated.
    -Siva

    Now instead of the VMImageName, I used SourceImageName as given in the example.
    The XML body now looks like
    <Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Name>mltestdeploy</Name>
    <DeploymentSlot>Production</DeploymentSlot>
    <Label>ZGVwbG95bWVudF9tbHRlc3RkZXBsb3k=</Label>
    <RoleList>
    <Role>
    <RoleName>mltesthost</RoleName>
    <RoleType>PersistentVMRole</RoleType>
    <ConfigurationSets>
    <ConfigurationSet i:type="LinuxProvisioningConfigurationSet">
    <ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationSetType>
    <HostName>mltesthost</HostName>
    <UserName>mladmin</UserName>
    <UserPassword>password</UserPassword>
    <DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication>
    </ConfigurationSet>
    </ConfigurationSets>
    <OSVirtualHardDisk>
    <MediaLink>http://portalvhds7dplkth082kmh.blob.core.windows.net/vhds/1v5wpayu.pwl201404160535060424.vhd</MediaLink>
    <SourceImageName>ml-centos-image</SourceImageName>
    </OSVirtualHardDisk>
    </Role>
    </RoleList>
    </Deployment>
    Even now I get the same 'Bad Request' error.
    Is there any way to find out which element is causing this Bad Request error? Thanks

  • Create String from all Collection Items

    Hi all, I've been using Project Siena for the last week and I'm having a lot of fun with it.
    Right now, I'm having a problem creating a string comprised of all the rows of a particular collection.
    I am trying to generate the string for an email body. So far I have a 1 column collection called EmailCollection. It consists of rows of text with the appropriate URL Encoded characters. I would like to be able to export all the rows of this
    collection to a string, and then add this string into the Launch(mailto:) body variable.
    Let me know if I'm not being clear with this, and thanks for any help in advance!
    Elliot

    Thanks for the reply, StonyArc. I actually used your original thread to get me started until I ran into problems with exporting the entire single column collection to a concatenated string. I found a way to get it working, though it's not an elegant solution
    and it wont work if the number of rows in the collection changes.
    I'll try to explain it here, and if anyone else can think of a better way, I'd like to try it :)
    I needed to create an URL encoded string for my emails which consisted of the relevant pricing information from a Collection with 8 rows called NewPricingCollection. 
    Collect(EmailPricing, Substitute(Substitute(Substitute(Concatenate(NewPricingCollection!SetupItem,": ", NewPricingCollection!NewAmount, " ", NewPricingCollection!UnitType, "s ($", NewPricingCollection!TotalPrice, ")"), " ", "%20"), "$", "%24"), ":", "%3A"));
    This created a single column collection with 8 rows which looked like this: SetupItem: 5 Units ($TotalPrice). I used the substitute function to replace the non-URL friendly characters with their encoded equivalents. I'm not sure if this is the best
    practice use of the Substitute function by the way.
    Once I had the Single Column Collection, I couldn't find a way to concatenate the contents of each row into a single string. I was able to use the Lookup function to retrieve the first row of the collection, but that was it. Note that I may be using the
    lookup function incorrectly too :)
    I ended up using Last and LastN Functions to retrieve the specified number of rows from the end of the collection. Then I used the Lookup function to retrieve the string from the first row of each retrieved collection, then concatenated it together as a
    single string - along with the rest of the email body.
    LookUp(EmailPricing, Result in EmailPricing, Result) & "%0A" & LookUp(LastN(EmailPricing,7), Result in EmailPricing, Result) & "%0A" & LookUp(LastN(EmailPricing,6), Result in EmailPricing, Result) & "%0A" & LookUp(LastN(EmailPricing,5), Result in EmailPricing, Result) & "%0A" & LookUp(LastN(EmailPricing,4), Result in EmailPricing, Result) & "%0A" & LookUp(LastN(EmailPricing,3), Result in EmailPricing, Result) & "%0A" & LookUp(LastN(EmailPricing,2), Result in EmailPricing, Result) & "%0A" & LookUp(LastN(EmailPricing,1), Result in EmailPricing, Result)
    This created a string that looked like this inside of an email body:
    SetupItem1: 5 Units ($TotalPrice)
    SetupItem2: 5 Units ($TotalPrice)
    SetupItem3: 5 Units ($TotalPrice)
    SetupItem4: 5 Units ($TotalPrice)
    SetupItem5: 5 Units ($TotalPrice)
    SetupItem6: 5 Units ($TotalPrice)
    SetupItem7: 5 Units ($TotalPrice)
    SetupItem8: 5 Units ($TotalPrice)
    As you can see it will only work correctly with a collection of 8 rows, so if the number of items changes, then I'll need to find a better solution. 

  • How to create an array of a cluster?

    Hello!
    Now we need some help or tip again :-) We have an array of strings coming out from a for-loop. We want to pick this array in peaces and get the string-elements out. These elements we want to get into a cluster together with boolean constant. Of this cluster we then want to create an array. The problem is that we do not know how to overcome the trouble with data-types and for-loopes... *scratching our head...* Anyone? Thank you

    Hello Ex-jobb,
    have a look at my example. I included a second way to build your array of cluster.
    The string generation at the left of the diagram is to simulate your text file reading, it also gives you an array of strings.
    This array is in the upper part converted by using autoindexing of an for-loop. In the lower part I used just an "Index Array" with
    "Build cluster" and "build array".
    Hope this helps,
    GerdW
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    ArrayOfCluster.vi ‏29 KB

  • Event structure to detect value change of a control within a cluster in an array

    I have 1D array that contains a cluster. The cluster contains a numeric and a boolean control.
    If the user starts to edit the numeric control value i would like to call one subVI, and if the boolean control value is changed, call a different subVI.
    The array control on the front panel allows the user to edit a number of the array elements. 
    I would like to use an event structure to detect a value change in the cluster. When editing the Events, in the Event Sources panel i get the option to select only the array, not the cluster within the array or the controls within the cluster. Can the Event structure be opened up to show controls within clusters and arrays?
    The solution i am using is to detect a mouse up event on the array and then use property nodes to  determine if the key focus is on the numeric, and  a case structure to determine which subVI to call. This works, but is there a better (simpler) way?
    Thanks, Blue.

    Thanks for the responses guys.
    The tricky bit was that i wanted the numeric control values to flag they were going to be edited, so i could call a subVI, before their values were changed by the user. This is done by using the key focus property node, - i need to detect changes on the fly rather than post the event.  Probably didn't make this clear enough in my original post. 
    The array is of variable size depending on if the user decides to insert or delete elements. The user also has the option to click and edit the array without having to do to much scrolling through the array index, as the FP shows several elements at a time. The Event Structure does a good job of automatically determining which element in the array is being edited, and returning those values to the property nodes. Turned out simpler than i thought it might be at one point!
    Cheers, Blue. 
    Message Edited by BlueTwo on 01-15-2009 06:52 AM
    Attachments:
    evstrct1.jpg ‏63 KB

  • Get the ID of a dynamically created symbol from library, INSIDE another symbol.

    Hi everyone,
    I'm trying to get the id from a dynamic created symbol from library.
    When dynamically creating the symbol directly on the stage (or composition level), there's no problem.
    But I just can't get it to work when creating the symbol inside another symbol. 
    Below some examples using both "getChildSymbols()" and "aSymbolInstances" 
    // USING "getChildSymbols()" ///////////////////////////////////////////////////////////////////////// 
    // ON THE STAGE 
    var m_item = sym.createChildSymbol("m_item","Stage");
    var symbolChildren = sym.getChildSymbols(); 
    console.log(symbolChildren[0].getSymbolElement().attr('id')); // ok eid_1391853893203
    // INSIDE ANOTHER SYMBOL
    var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement()); 
    var symbolChildren = sym.getSymbol("holder").getChildSymbols(); // Am i using this wrong maybe?
    console.log(symbolChildren.length) // returns 0 so can't get no ID either
    // USING "aSymbolInstances"" ////////////////////////////////////////////////////////////////////////// 
    // ON THE STAGE
    var m_item = sym.createChildSymbol("m_item","Stage"); 
    console.log(sym.aSymbolInstances[0]); // ok (i guess) x.fn.x.init[1] 0: div#eid_1391854141436
    // INSIDE ANOTHER SYMBOL
    var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
    console.log(sym.getSymbol("holder").aSymbolInstances[0]); // Javascript error in event handler! Event Type = element 
    In this post http://forums.adobe.com/message/5691824 is written: "mySym.aSymbolInstances will give you an array with all "names" when you create symbols"
    Could it be this only works on the stage/ composition level only and not inside a symbol? 
    The following methods to achieve the same are indeed possible, but i simply DON'T want to use them in this case:
    1) Storing a reference of the created symbol in an array and call it later by index.
    2) Giving the items an ID manually on creation and use document.getElementById() afterwards.
    I can't believe this isn't possible. I am probably missing something here.
    Forgive me I am a newbie using Adobe Edge!
    I really hope someone can help me out here.
    Anyway, thnx in advance people!
    Kind Regards,
    Lester.

    Hi,
    Thanks for the quick response!
    True this is also a possibility. But this method is almost the same of "Giving the items an ID manually on creation and use document.getElementById() afterwards".
    In this way (correct me if i'm wrong) you have to give it an unique ID yourself. In a (very) big project this isn't the most practical way.
    Although I know it is possible.
    Now when Edge creates a symbol dynamically on the Stage (or composition level) or inside another symbol it always gives the symbol an ID like "eid_1391853893203".
    I want to reuse this (unique) ID given by Edge after creation.
    If created on the stage directly you can get this ID very easy. Like this;
    var m_item = sym.createChildSymbol("m_item","Stage");
    var symbolChildren = sym.getChildSymbols(); 
    console.log(symbolChildren[0].getSymbolElement().attr('id')); // ok eid_1391853893203
    I want to do exactly the same when created INSIDE another symbol.
    var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
    Now how can I accomplish this? How can I get the Id of a dynamically created symbol INSIDE another symbol instead of created directly on the stage?
    This is what i'm after.
    Thnx in advance!

  • Set MS Report to obtain data from programmatically created dataset?

    Greetings everyone!
    My problem: I decided that I should add a bunch of reports in the app develop for a hospital. I programmatically coded a search from a Mysql database and added a dataset (let me call it "patients_search) as usual. Then I created a DataGridView and used
    the created Dataset as its data source, this works properly, no problem.
    But as of recent, I decided that I should quit using datagrid for my reporting and use the VS 2013 inbuilt MS Report Viewer. I would like to create a report and let it pick its data from the existing dataset ("patients_search") which is created programmatically.
    So instead of binding my dataset to a datagridview, now I want to bind it to a report.
    But it seems the MS Report wants me to use a dataset created with the designer, not programmatically created dataset -and I don't want this.
    I have searched many places online, I have not seen anyone do that. I have seen some people say that it is impossible to link the MS Report to a programmatically created dataset.
    I have come here to ask for more experts help. Is there a way I can do this inside VB.NET? Please help.
    If this is not possible, then what's the other possible way of creating reports? I can't purchase Crystal Reports.
    Any help is appreciated.
    Thanks,
    Frank.
    "I can do all things through Him who strengthens me"

    Hi savedlema,
    As your issue is related to reports, I'm moving your post to Reports forum for better supports. Thanks for your understanding.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Create Array from Record

    Hi
    Somebody have a example how can I to create a Array from record ?
    tks

    Hi!
    Pls go through the followinglink --
    [url http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10807/05_colls.htm]VArray From Record In Oracle
    Hope that will help u.
    Regards.
    Satyaki De.

  • How to derive commitment item and fund center when create PR from MRP.

    Dear Experts,
    No commitment item and fund center are derived when I create PR from MRP. I have to run transaction fm_mrp_pr to derive commitment item and fund center. However, I want to derive FM assignments during creating PR through transaction MD04. I plan to use user-exit to derive FM assignment while PR is creating from MRP. Which FM bapi, functions,etc... can I use in user-exit to derive FM assignment? Do you have an idea?
    Thank you in advance,
    Sibel

    Hi Sibel,
    Please check if note 1247722 and 1127135 are applied in your system. If not, kindly apply it and retest your issue. It should resolve it.
    Kind Regards,
    Vanessa.

  • From SharePoint2013 list item data how to create Google Interactive Chart?

    HI All,
    From SharePoint2013 list item data how to create Google Interactive Chart?
    Thanks in advance!

    Hi,
    To push data from list items to Google Chart, we can use JavaScript Client Object Model or REST API to retrieve the data needed.
    Here are two links about using JavaScript Client Object Model to access list items:
    http://msdn.microsoft.com/en-us/library/office/hh185006(v=office.14).aspx
    http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
    From the links from the official site of the Google Chart, we can find out the method to populate data into Chart:
    https://developers.google.com/chart/interactive/docs/quick_start
    https://developers.google.com/chart/interactive/docs/examples#gauge_example
    Best regards
    Patrick Liang
    TechNet Community Support

Maybe you are looking for

  • How do I port forward or open a port on the Airport time capsule to hook p a security system?

    I have an airport time capsule and a security system.  The installer doesn't know anything about using routers etc, especially on a mac.  They say I have to port forward or open a port specifically of this device.  I have very few skills when doing t

  • Sync freezes my laptop

    Hi I have the following set up: IPod touch 32GB, Vista Business OS and a new Vaio BX61MN. When I go to sync my touch with ITunes after transferring around 50 songs from my 3,000 library across to the touch......it freezes. Laptop becomes totally froz

  • CREATION OF INFOTYPE _ LIST BOX ISSUE

    Hi all, I am creating a custom infotype through pm01. I want to use say 10 list boxes in this infotype where the values should come from different fields of a data table. I am using vrm_set_values for this. I am passing values through an internal tab

  • Photoshop CS3 crashes when I try to deactivate it

    I will deactivate and delete Photoshop CS3 (10.0.1 German) and then install Photoshop CS5. I use Mac Pro Early 2009 and Mac OS 10.6.3 (German). When I start the deactivation (menu help) Photoshop crashes directly. I have start the Mac with Shift-Key;

  • I can,t open the files with my Adobe ID

    I trent change my adobe ID but, i don,tnothing