LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

build path from string control

Solved!
Go to solution

Does anyone know why when I Use a string constant fed into a build path function my vi creates the file properly but when I change it to a control so that I can input a number to the file name I get error 1059 unexpected file type?

0 Kudos
Message 1 of 29
(5,775 Views)

Hello TSCline,

You have posted in the Idea Exchange. I will move this post to the LabVIEW Board so it will be visible to the engineers and other users who will assist you. Please see this Quick Introduction to the Forums for New Users documentation.

 

Jordan

Forum Moderator

0 Kudos
Message 2 of 29
(5,769 Views)

I don't quite understand what you are doing. What constant are you feeding to Build Path? What is the base path? What are you changing to a control? The base path or the string? What is generating the 1059 error?

Can you post your code, or at the very least a screenshot? Please post screenshots in PNG/JPEG/GIF format. DO NOT POST BITMAPS. Remember: renaming a .bmp file to .png does NOT magically change its format.

0 Kudos
Message 3 of 29
(5,757 Views)

Make sure there are no extra control characters in your string control (i.e. Are you pressing the Enter key?).  To check this, right click on your control and select Codes display.  Are you leaving off the extension?

 

 

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 4 of 29
(5,752 Views)

I'm trying to write to a file each time I update data. Everything was working fine until i realized that each time I stop excecution and start back up I lose all data if I replace it again so I wanted to be able to add a new number of my choosing each time to the file name but keep the full base name. I also wanted it to save in a base location while creating a new folder for each month and each day. If i a string control and concatenate it the error comes from the open/create/replace function but doesn't come up when I use a string constant.

 

The first picture is my vi and the 2nd is the sub vi used to create the folder if it doesn't exist

Download All
0 Kudos
Message 5 of 29
(5,726 Views)

First off, DO NOT USE HARD-CODED PATHS THE WAY YOU ARE. Yes, I am screaming because I always see this. What will happen if someone else tries to run the code? Answer: it won't work because they cannot write to your user folder. What happens if this VI is run on Windows XP? Answer: it won't work because XP doesn't use C:\Users for the location of user folders.

 

You do not have a string constant or control. You have a path control called "string". That's not the same thing. You have not indicated what the value is. Have you placed a probe on the output of the second Build Path to verify the path?

Message 6 of 29
(5,710 Views)

Show us the content of your string constant vs the results of the build path with the panel control.

The error message should contain the path that it tried to open. Does the path look correct and is it the exact same as what is in your string constant?

 

Also, are you closing the file and then reopening to append new data to an existing file?

If so you will need to set the file position at the end of the file before writing new data or it will over write data from the begining.

 

Omar
Message 7 of 29
(5,710 Views)

I am still learning labview as quickly as I can so thanks for the feedback. I don't understand why you call it a path constant called string. It's pink and appears as a string constant on the front panel.

0 Kudos
Message 8 of 29
(5,706 Views)

Yes the result in the error is exactly what it should be. All the string control contains is the number 1. 

 

What I am trying to do is update a file. I collect data periodically and want to add the contents into a file. right now it essentially replace the old file with a new one of the same name. Since I store the data in the array it accomplishes what I want but in a poor way. What is the best way to add data onto an existing file. Do I need to open it, read it into an array and then add onto it? Your help is very appreciated

0 Kudos
Message 9 of 29
(5,705 Views)

String or path, we need to see the value that you are passing into the file open function.

Use a probe, a front panel indicator or something that will show us the exact path that you are passing in.

 

I sure you have extra stuff or not enough stuff or wrong stuff in our file path.

 

 

Omar
0 Kudos
Message 10 of 29
(5,702 Views)