LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Micro-Nuggets !!! ~~~~ Post 'em if you got 'em

Micro-nugget:

It's already been mentioned to use "Conditional Disable Structures" to achieve different behaviors when RUN_TIME_ENGINE is TRUE or FALSE. I also really like to use conditional disable symbols for when I do or don't have hardware connected to my computer. You go to Project > Properties > Conditional Disable Symbols to add your own symbols. So as an example, I'll have one subdiagram for "Camera==TRUE", and another for "Camera==FALSE,default".

 

You could also use a case structure, but with conditional disable structures, the unused subdiagrams do not effect your final code. (For example, a broken VI in the inactive subdiagram will not prevent your application from running). You might even want to exclude certain VIs from a build because they require a toolkit that a specific target computer won't have.

 

Nano-nugget:

One thing I never cared for about the conditional disable symbols is that you have to open up the dialog, and then type in the value for each symbol, which is a little cumbersome. Today I found out about two VIs: GetSymbols and SetSymbols. They are located in "C:\Program Files (x86)\National Instruments\LabVIEW 20xx\resource\plugins\Utility\IfDef.llb". You can use these to modify the conditional disable symbols of your project! I made a quick GUI to make it easier to edit the symbols, you could also use this as part of your pre-build actions to make sure you don't forget to enable the hardware before building an executable.

 

capture.PNG

 

Message 361 of 368
(1,187 Views)

I might have found something that I think would make Altenbach proud.

 

I am refactoring a circular buffer. In order to handle the index roll over in the negative direction, the designer did what is on the top of the diagram. It made sense. But I discovered that a Quotient & Remainder does the same job.


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
0 Kudos
Message 362 of 368
(268 Views)

There was surprise, shock, awe, and amazement when I mentioned that Excel files could be accessed like a database.

ThomasHenkel was nice enough to supply a simple example.

 

There are a few nuances you need to know about that was not mentioned yet.

- xlsx sheet-names = data base tables

- the $ character must be appended to the sheet-name and be surrounded by square brackets Example: [SheetName$]

- Column names that contain a space must be surrounded with ` (IE ASCII char 0x60. Not ' or ") Example: `LastName`

- There is a 255 char limit on any one cell. A work-around is to have a dummy string longer than 255 characters in one of the first 8 rows for that column.

- Requires the DB Connection Tool Kit

 

I have attached a slightly modified version of the spread database access vi that I use. It attaches all the required chars for you so all you need to know is the column names and sheet names of your "database".

 

Enjoy!

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
Download All
Message 363 of 368
(224 Views)

@Hooovahh wrote:

Uh...interesting choice.  Personally I would have expected NI to distribute an API for NIPM by installing it through...NIPM...Still glad there is an API.  Would you still recommend this post for an example, or is there something newer?


There are a few packages that was posted to VIPM before NIPM was a thing and they've stayed there.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 364 of 368
(144 Views)

I get an error trying to connect:

 

"NI_Database_API.lvlib:DB Tools Open Connec (String).vi->Extract Excel Data Example (LV2012).vi<ERR>ADO Error: 0x800A0E7A
Exception occured in ADODB.Connection: Provider cannot be found. It may not be properly installed.Help Path is C:\WINDOWS\HELP\ADO270.CHM and context 1240655 in NI_Database_API.lvlib:DB Tools Open Connec (String).vi->Extract Excel Data Example (LV2012).vi"

 

I have DBC toolkit installed (and using it daily)

0 Kudos
Message 365 of 368
(133 Views)

The Excel database driver used to be part of the Jet database engine that got installed with Microsoft Office when you installed Access. It should also have been installed with older Microsoft Office packages without Access as part of the Excel installation. But I doubt the modern Office 365 installer does that!

Rolf Kalbermatter
My Blog
0 Kudos
Message 366 of 368
(106 Views)

I got the same error; you need to install the db connection from the Microsoft website, don’t have the link available here, but if you search for it, you will find it. It installed a 365 version of it. I thought it was installing all of office but it didn’t. Once installed it works. 

0 Kudos
Message 367 of 368
(49 Views)

@mcduff wrote:

I got the same error; you need to install the db connection from the Microsoft website, don’t have the link available here, but if you search for it, you will find it. It installed a 365 version of it. I thought it was installing all of office but it didn’t. Once installed it works. 


Here's the link

Download and install Microsoft 365 Access Runtime - Microsoft Support

Message 368 of 368
(39 Views)