From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Shortcut Menu Plug-Ins

cancel
Showing results for 
Search instead for 
Did you mean: 

Paste Delimited Text.llb

Author: Brian Bean - Sobosoft LLC

 

This shortcut plugin takes any CSV or delimited data (including cut/copy from excel) and pastes it into arrays, tables, and multi-column list boxes.

For multi-column listboxes and tables, an additional sub menu item pops up allowing the user to separate the header row from the delimited data and use it in "column headers" of the control.  

 

Before:

Before paste.png

 

After:

After Paste.png

 

Edit Time Plugin Only for now.

 

https://github.com/bbean-LV/PasteDelimitedData

 

Attachment is saved in LabVIEW 2018. For install instructions, go here.

 

Note, there is a sister quick drop plugin with similar features here.

Download All
Comments
AristosQueue (NI)
NI Employee (retired)
on

This is useful. Can you extend it for moving into/out of sets and maps?

bean123
Member
Member
on

I'll take a look.  This will be my first foray into maps.  How to handle earlier LabVIEW versions that don't have maps?  Should I just create a permanent branch for >2019 and have two versions of the plugin? or is there some way to conditionally disable for older versions.

AristosQueue (NI)
NI Employee (retired)
on

Easiest is to just create a second plugin that is only for the new data types but calls any common subVIs in the first plug-in. Yeah, that makes it so that they have to be distributed as a pair, which isn't as nice, but that's the solution I'd reach for.

wiebe@CARYA
Knight of NI Knight of NI
Knight of NI
on

>How to handle earlier LabVIEW versions that don't have maps?

 

Variant attributes are what we used before there where maps.

 

They're not quite the same. Maps are strongly typed, and can have any type as key and value. Variant attributes have strings as key and variants as value. Variant attributes can (and probably should) be replaced by maps, but not always the other way around.

 

As a bonus this plugin would interact with a variant attribute map. I'm sure they'll be around for a while (in existing code).

wiebe@CARYA
Knight of NI Knight of NI
Knight of NI
on

>Easiest is to just create a second plugin that is only for the new data types but calls any common subVIs in the first plug-in. Yeah, that makes it so that they have to be distributed as a pair, which isn't as nice, but that's the solution I'd reach for.

 

I didn't have any problem making one plug in to support multiple different objects?

 

For me that was easier (e.g. not that hard 😊).

TeraTech
Member
Member
on

Can you save for LV 2017? No response in the version conversion forum.

^TeraTech.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Check out this lengthy post of mostly complaints)
bean123
Member
Member
on

>How to handle earlier LabVIEW versions that don't have maps?

 

>Variant attributes are what we used before there where maps.

>I didn't have any problem making one plug in to support multiple different objects?

 

My question was more related to distribution of the plug-in to people who don't have LabVIEW >= 2019.  If the plugin supports Maps, it can't be used by people who don't have a version of LabVIEW that supports maps.  I have to create a version of the plugin for >= 2019 (with Maps supported) and a version without any Map primitives for <=2018.  I wish there was a conditional disable symbol for LabVIEW Version.

 

Regarding variant attributes (I've used this excellent tool before), I could add support for those but do you think there is a use case for cutting and pasting CSV data.  Would you like to paste into a variant control or constant? How would the plugin determine the datatypes in the variant attribute dictionary?

crossrulz
Knight of NI Knight of NI
Knight of NI
on

TeraTech, I just added a 2015 version of the llb to the document.  I did not check it in any way; I just did a Save For Previous on the llb file.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
bean123
Member
Member
on

Ok Re supporting maps and sets.  I created a new branch here for LabVIEW >=2019 to support maps, sets.

 

Before I get too far I need a "sanity" check for two reasons:

 

1) I'm getting an insanity crash when I attempt to execute the plugin by copying and pasting csv data into a Map Control with a string key and I8 value (See Map I8.vi for the control to paste into).  The plugin seems to work properly and the data appears in the Map but if I attempt to move the control or save the vi, I get the fpsane crash.

successful paste.pngCrash.png

 

2) Check my approach for coding the csv data into the map (Execute Drop CSV Text to Map Control.vi). For the initial effort, I chose to just try only supporting string keys with numeric, string and path values.  Based on my limited understanding of maps, there could be a lot of different variations if the key datatype is expanded to include other data types besides string.  Is their some simple trick using variant and scripting I'm missing to have more flexible and simple code to convert the CSV data into keys and values?

 

mapcode.png

 

Is there some way to get the reverse of Map->Array to work.  Again caveat here, I'm a noob to Maps.  Disabled code that didn't work:

disabled.png

 

wiebe@CARYA
Knight of NI Knight of NI
Knight of NI
on

>My question was more related to distribution of the plug-in to people who don't have LabVIEW >= 2019.  If the plugin supports Maps, it can't be used by people who don't have a version of LabVIEW that supports maps.  I have to create a version of the plugin for >= 2019 (with Maps supported) and a version without any Map primitives for <=2018.  I wish there was a conditional disable symbol for LabVIEW Version.

 

Ah. Didn't get that at all. Now AQs comment makes more sense.

 

I'm not sure if there's a convenient way to do it. Finding an easy way to delete all map stuff and than saving back probably, and that's why AQs solution might be easier.

 

> Would you like to paste into a variant control or constant?

 

If I was to use this (I tend to not get used to 3rd party tools, even if I'm the 3rd party): both. 

 

> How would the plugin determine the datatypes in the variant attribute dictionary?

 

Don't know. I guess the editor requires support for all datatypes. So, an enum to select the data type, and entry controls for all types. In a subpanel construction, so clusters and arrays are supported... Tedious, so I'd forget I ever mentioned it 😊.

 

AristosQueue (NI)
NI Employee (retired)
on

> I wish there was a conditional disable symbol for LabVIEW Version.

 

It is somewhat surprising how rare this comes up, until I realize that there's nearly no use case for it except the Quick Drop plugins and right-click plugins. Yes, there are a few toolkits that would benefit, but VIPM is smart about version control, and maintaining/testing multiply-compilable code is a sufficient pain, I suspect most library devs wouldn't be interested. It's only those things where different LabVIEWs can pull from the same source base that need it.

TeraTech
Member
Member
on

Dowloaded and installed Paste Delimited Data (2015).llb.

Had to create the \PopupMenus\edit time panel and diagram folders under LabVIEW Data as there were not there on my PC.

Had to rename the llb to "Paste Delimited Data.llb". to get to work.

 

Awesome tool!  Now the question - the Undo doesn't work.  Should it?

^TeraTech.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Check out this lengthy post of mostly complaints)
wiebe@CARYA
Knight of NI Knight of NI
Knight of NI
on

>Awesome tool!  Now the question - the Undo doesn't work.  Should it?

 

That normally is done automatically by the plugin framework.

 

However, for controls in this case it's just a value change. So it's not scripting, it's VI Server. The undo mechanism doesn't includes the value change in the undo stack.

 

Don't use Value property to set the value, use the "Value (Undo)" (or "Value (Undoable)") property:

 

Undo Transation.png

bean123
Member
Member
on

@ - If you have some time, can you comment on:

  1. the fpsane issue above
  2. technique for updating the map above
  3. appropriate technique to use for undoing (see below)

 thanks for down converting to 2015. Is there a way to Save for Previous for the whole llb?  I tried but could only figure out how to save each individual file, one at a time which was very tedious.

@  - Thank you for the undo suggestion

 

@TeraTech - Thanks for the compliment and yes undo makes sense.....

I created a new branch for undo in the repo.  Thought it would be easy based on wiebe's suggestion, but there are a couple of cases where it doesn't work:

  1. Block diagram array constants don't have the Value (Undo) option...unless its hidden somewhere? supersecret is not enabled on the VM I'm using 
  2. The option to paste the first row in the CSV data to the multicolumn listbox/table "column headers" doesn't have an option for undo.

I attempted to create a transaction.beginundo for these cases in the "Execute Paste Delimited Data.vi" .  but I'm not sure if this is a no-no in the subvis of shortcut menu because the output of the VI is Failed Transaction which may be used at a higher level to cancel things.  Because I'm sometimes getting fpsane 🤔 crashes now after adding undo features.  For instance if you try right clicking on a 1D array dbl, pasting and then repeat on a 2d array dbl array, then undo twice LabVIEW crashes.

 

New branch for Undo is here. This is quickly snowballing into CM fun, merging and change tracking with llbs and labview versions is fun.

 

 

 

 

 

crossrulz
Knight of NI Knight of NI
Knight of NI
on

To save to previous, you need to have the LLB in a project and back save the project.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Contributors