Failure to read multiline string with Read Key.vi

I converted 2D array into a spreadsheet string and attempetd to write it as a key value into a configuration file. This worked just fine. However, when I attempted to read this multiline string using Read Key.vi, I got just the first line in return (see two vi's attached).
As sufficient documentation on configuration file vi's is all but missing, could you please advise on their (undocumented) features? What do I miss?
Thank you.
Michael
Attachments:
Save_2D_array_in_config_file.vi ‏29 KB
Read_2D_array_from_config_file.vi ‏31 KB

Hi Michael,
MichaelS wrote in news:506500000008000000F7980000-
[email protected]:
> I converted 2D array into a spreadsheet string and attempetd to write
> it as a key value into a configuration file. This worked just fine.
> However, when I attempted to read this multiline string using Read
> Key.vi, I got just the first line in return (see two vi's attached).
I use Config files all the time. Much more user-friendly than the
Registry. They are a Microsoft thing really, rather than LabView, and
come from Windows 3.11. Each value is limited to one line, so when you
write a spreadsheet string with end-of-line characters in it, you're
effectively breaking the .inf file
The solution? Try putting a "Search and Replace String
" after your
"Array To Spreadsheet String". Wire "Replace All" with a TRUE constant,
and wire "Search String" with a string in "\" view and enter \r\n (or do
0A0D in Hex view) and then then wire Replace String with a ";"
Now your .inf file will look like:
[Array]
Data=1.0000,0.0000,0.0000;0.0000,2.0000,0.0000;0.0000,0.0000,3.0000;
When reading it, just reverse the search and replace strings above.
I hope this helps,
Andrew

Similar Messages

  • Read Key and Write Key not working as expected with paths on RT

    The configuration file VIs Read Key (Path) and Write Key (Path) don't seem to work as expected (at least not as I was expecting them to) on an RT target.
    When working on my WinXP PC with these two VIs, paths are translated to what looks like is supposed to be a device-independent format before being written to disk. The path C:\dir\file.txt becomes /C/dir/file.txt when writing and vice versa when reading. On my RT target, however, that same path is written to disk as C:\dir\file.txt, unchanged from the native format.
    The translaton of a native path to and from the device-independent format appears to be the responsibility of Specific Path to Common Path and Common Path to Specific Path. These both use the App.TargetOS property to determine the operating system. In the case structure for these two VIs, however, there is no case for PharLap or RTX. (My RT hardware is runnng PharLap; I don't know enough about RTX to comment.) This means that the results of String to Path or Path to String are used without translating between the device-independent format to the native path format.
    This isn't a problem if you create a configuration file on one machine and use it on that same machine. I noticed this only when tranferring a config file from my PC to the RT target, where the target would not open the file paths it loaded from the configuration file.
    This occurs on 7.1.1 and 8.0.  I don't have 8.20 to see if happens there, too.

    In LV 8.2, this was fixed.
    The problem is App.TargetOS returns "Pharlap" on RT systems, and "Pharlap" is handled by the default case ("invalid OS target") in LV 8.0.  In LV 8.2 the default case is "Windows 95/NT", however.  The reason you could write and read an .ini file on RT in LV 8.0 and earlier is because these two VIs (listed below) were both running the default case of "invalid OS target".
    vi.lib\Utility\config.llb\Common Path to Specific Path.vi
    vi.lib\Utility\config.llb\Specific Path to Common Path.vi
    As you saw, this fails when you perform one operation in Pharlap but the other in Windows.  You can fix this by modifying the two VIs listed above.  Just go to the case structure and make "Windows 95/NT" the default case.

  • Read Key(String).vi and spaces

    Hello all,
    I am having some trouble with the Read Key(String).vi. One of the strings I am reading in ends in spaces. This vi seems to want to truncate any trailing spaces. I don't want it to do that. Is there anyway of modifing the vi to not truncate spaces? Or should I not allow spaces to be written?
    Thanks in advance,
    Glen

    I haven't dug very far into the config file VIs but the easiest thing to do is to enclose all of your strings with quote marks ("). If you do that, key values with trailing spaces are read correctly.

  • Optimal read write performance for data with duplicate keys

    Hi,
    I am constructing a database that will store data with duplicate keys.
    For each key (a String) there will be multiple data objects, there is no upper limit to the number of data objects, but let's say there could be a million.
    Data objects have a time-stamp (Long) field and a message (String) field.
    At the moment I write these data objects into the database in chronological order, as i receive them, for any given key.
    When I retrieve data for a key, and iterate across the duplicates for any given primary key using a cursor they are fetched in ascending chronological order.
    What I would like to do is start fetching these records in reverse order, say just the last 10 records that were written to the database for a given key, and was wondering if anyone had some suggestions on the optimal way to do this.
    I have considered writing data out in the order that i want to retrieve it, by supplying the database with a custom duplicate comparator. If I were to do this then the query above would return the latest data first, and I would be able to iterate over the most recent inserts quickly. but Is there a performance penalty paid on writing to the database if I do this?
    I have also considered using the time-stamp field as the unique primary key for the primary database instead of the String, and creating a secondary database for the String, this would allow me to index into the data using a cursor join, but I'm not certain it would be any more performant, at least not on writing to the database, since it would result in a very flat b-tree.
    Is there a fundamental choice that I will have to make between write versus read performance? Any suggestions on tackling this much appreciated.
    Many Thanks,
    Joel

    Hi Joel,
    Using a duplicate comparator will slow down Btree access (writes and reads) to
    some degree because the comparator is called a lot during searching. But
    whether this is a problem depends on whether your app is CPU bound and how much
    CPU time your comparator uses. If you can avoid de-serializing the object in
    the comparator, that will help. For example, if you keep the timestamp at the
    beginning of the data and only read the one long timestamp field in your
    comparator, that should be pretty fast.
    Another approach is to store the negation of the timestamp so that records
    are sorted naturally in reverse timestamp order.
    Another approach is to read backwards using a cursor. This takes a couple
    steps:
    1) Find the last duplicate for the primary key you're interested in:
      cursor.getSearchKey(keyOfInterest, ...)
      status = cursor.getNextNoDup(...)
      if (status == SUCCESS) {
          // Found the next primary key, now back up one record.
          status = cursor.getPrev(...)
      } else {
          // This is the last primary key, find the last record.
          status = cursor.getLast(...)
      }2) Scan backwards over the duplicates:
      while (status == SUCCESS) {
          // Process one record
          // Move backwards
          status = cursor.getPrev(...)
      }Finally another approach is to use a two-part primary key: {string,timestamp}.
    Duplicates are not configured because every key is unique. I mention this
    because using duplicates in JE has more overhead than using a unique primary
    key. You can combine this with either of the above approaches -- using a
    comparator, negating the timestamp, or scanning backwards.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Has anyone noticed how easy it is to read a passcode that lights up with each key you press from across a room? Is there a way to stop keypad from lighting up on iPhone 4S, iOS 7?

    Has anyone noticed how easy it is to read a passcode that lights up with each key you press from across a room? Is there a way to stop keypad from lighting up on iPhone 4S, iOS 7.0.3?

    Has anyone noticed how easy it is to read a passcode that lights up with each key you press from across a room? Is there a way to stop keypad from lighting up on iPhone 4S, iOS 7.0.3?

  • How can i read a string with nextToken() of StreamTokenizer

    I need for my class paper to read a string from a file and i used the StreamTokenizer's method nextToken but i can not read a string with it. my code is:
    StreamTokenizer st = new StreamTokenizer(the code that gets the input from the file)
    String line;
    while ((line !=br.readLine()) != null) {
    String surname = (st.nextToken()).trim();
    but it gets me some error of:
    int can not be dereferenced
    what should I do to get the string i need?

    Look at the API for java.io.StreamTokenizer. In particular, look at the return type for nextToken().
    Good luck.

  • Pdf file not opening on pushing fdf file with F key in Adobe  Reader

    Well i am a novice developer in case of PDF Development.
    The problem which i am facing is:-
    In our application a PDF document submits the data to server and server sends back FDF to client with f key as http path of PDF which is present on web server.
    This all works well in acrobat professional 7.0 but in abobe reader 8.0 the PDF file doesn't open up on pushing FDF.
    On debugging the problem i found out that if server sends response within 480 milliseconds then reader is showing the pdf otherwise it don't shows up.Since in our application it will always take more than this time because of several operation performed to serve the request posted to server,So the
    PDF will never show up in case of reader.
    I was unable to understand what make it special in acrobat professional that session lasts more than 480 milliseconds whereas in reader the session doesn't last that long.
    I really need uregent help on this.
    Thanks in advance for help.

    It would be handy if you didn't double post too.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/81ed0362-4033-4a31-b265-c1aba43c3d14/pdf-file-not-opening-in-browser-for-sharepoint-2010?forum=sharepointadminprevious
    To answer your question, you've tried most things that I normally see working, but there may be an extra solution here for you.  The solution 2 Powershell that deals with updating the Inline MimeType may help.
    http://www.pdfshareforms.com/sharepoint-2010-and-pdf-integration-series-part-1/
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Network-Shared Variable - read string with CVI

    I need to read an NSV string with CVI.  I have been digging into accessing and writing NSV with CVI, but they are all scalar value.  What should I do with strings, clusters and arrays?

    'm an employee at National Instruments and I wanted to make sure you didn't miss the Network Variable API that is provided with LabWindows/CVI, the National Instruments C development environment. The the Network Variable API will allow you to easily communicate with the LabVIEW program over Shared Variables (http://zone.ni.com/devzone/cda/tut/p/id/4679). While reading these links, note that a Network Variable and a Shared Variable are the same thing - the different names are unfortunate...
    The nice thing about the Network Variable API is that it allows easy interoperability with LabVIEW, it provides a strongly typed communication mechanism, and it provides a callback model for notification when the Network/Shared variable's properties (such as value) change.
    You can obtain this API by installing LabWindows/CVI, but it is not necessary to use the LabWindows/CVI environment. The header file is available at C:\Program Files\National Instruments\CVI2010\include\cvinetv.h, and the .lib file located at C:\Program Files\National Instruments\CVI2010\extlib\msvc\cvinetv.lib can be linked in with whatever C development tools you are using.
    Thomas N.
    Applications Engineer
    National Instruments

  • Error in reading table TFK056A with interest key

    While posting interest I am getting the following error "Error in reading table TFK056A with interest key". I have configured my interest keys well. Please assist.

    Hi Panashesean,
    The reason for this error could be you have in the line items an interest key (ikey) which is missing in table TFK056A. Though you have a different interest key in the master record the system will consider the line item first.
    Interest Key Documentation states:
    "If more than one interest key is defined for a line item, these interest keys are normally prioritized as follows:
    1. Interest key in line item
    2. Interest key that is defined for transactions identified as additional receivables
       An interest can depend on the operative company code in the rule for
       additional receivables.
    3. Interest key in dunning level
    4. Interest key in contract account master record"
    You need to remove the interest key in the line item for the system to use the master record ikey OR or define (ikey) in table TFK056A.
    I hope this works.
    regards,
    David

  • U32 Read Key.vi with hex value

    Is there a way for the Read Key.vi  to read an hexadecimal value when set to U32 (or I32)? (maybe a case for the LabVIEW Exchange Idea?).
    It would be cleaner than to read an hex string and then convert it.
    Ben64

    That might be one for the idea exchange.  I'm seeing a Decimal String To Number inside of that polymorphic instance.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Read key (variant) - OpenG

    Can anyone help with this? I've already posted it to the OpenG forums and Jim Kring thinks it's probably a LV bug. Can anyone confirm?
    The problem occurs when I set the data type to VISA session - LabVIEW crashes just before the read key (variant) vi runs.
    I'm using LV 7.1, and I've attached an example to show what I mean.
    Any ideas what's going
    on? And if someone could try it in a later version of LabVIEW that would be really interesting too.
    Thanks & regards,
    Jon
    Attachments:
    Variant config test.llb ‏1507 KB
    Options test.txt ‏1 KB

    OK,I feel a bit on an idiot because I got the filename wrong in the VI.
    Anyway, I tried it in 8.5 (I only have 7.1 at home) and I can see exactly where the problem is. In 8.5 it gives an error rather than a  complete crash. 
    I've attached a much simplified version.  I get Error 116:
    "Error 116 occurred at Flattened String To Variant in Variant config test2.vi
    Possible reason(s):
    LabVIEW:  Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data.
    Any idea what's going on? 
    Jon.
    Attachments:
    Variant config test2.vi ‏17 KB
    Options test.txt ‏1 KB

  • Read key bug?

    Hi Technical and Expert NI Labview.
    I am not sure if the read key.vi carries bug.
    See my simple attached
    I am using Labview 7.1
    When I run the program , it reads "media_assets lpmsg.ini"  instead of "media_assets\helpmsg.ini"
    What could be the problem?
    Pls advise Thanks
    Clement
    Attachments:
    test_readkey.vi ‏23 KB
    myconfig.ini ‏1 KB

    Hi Clement
    You only need raw strings if your string contains special characters like \. You can open the "Read Key (String).vi" and check what happens if you work with raw strings or not.
    Daniel

  • ConfigFile Read Key (Path).vi BUG?

    I want to Read a UNC Path from my Configuration File.
    [Path]
    UNC_Path=\\Hssvr01\5_Test_Data\17_Labview\2009
    For this I use the LV2009 VI Read Key (Path).vi and as result I get:
    H:\ssvr01\5_Test_Data_Labview\2009
    When I set in the Configfile the UNC Path to:
    UNC_Path=\\\\\Hssvr01\\5_Test_Data\\17_Labview\\20​09
    The result is:
    \\Hssvr01\5_Test_Data\17_Labview\2009
    This looks OK but I updatated from LV8.2.1 to LV2009 and in LV8.2.1 the variant with "UNC_Path=\\Hssvr01\5_Test_Data\17_Labview\2009" gives me as result "UNC_Path=\\\\\Hssvr01\\5_Test_Data\\17_Labview\\2​009"
    Why this have in LV2009 changed? Is this a Bug?
    In the LV2009 help I found this:
    http://zone.ni.com/reference/en-XX/help/371361F-01​/glang/unc_filename_support_of_io/
    Isn't this valid for Read Key (Path).vi?
    Attachments:
    UNC_Path_LV2009.vi ‏13 KB
    Config.ini ‏1 KB

    Check towards the bottom of this help page (also available from within LabVIEW)
    Quote:
    "The Configuration File VIs can read and write raw or escaped string data. The VIs read and write raw data byte-for-byte, without converting the data to ASCII. In converted, or escaped, strings LabVIEW stores any non-displayable text characters in the configuration settings file with the equivalent hexadecimal escape codes, such as \0D for a carriage return. In addition, LabVIEW stores backslash characters in the configuration settings file as double backslashes, such as \\ for \. Set the read raw string? or write raw string? inputs of the Configuration File VIs to TRUE for raw data and to FALSE for escaped data."
    All clear?
    LabVIEW Champion . Do more with less code and in less time .

  • Read Key

    Hi there :)
    I was wondering if someone could put a little example of a read key command
    e.g. int read() found this in APIs, could you clarify this :)
    I am just writing a simple (It has to be simple) program to which I would like some user interaction.
    Thanks for your help with this, just trying to learn.
    fun times

    Hi :)
    Could someone clarify this for me.
    Wrap a BufferedReader around an InputStreamReader that reads from System.in:
    import java.io.*;InputStreamReader isr = new InputStreamReader(System.in);BufferedReader in = new BufferedReader(isr);
    Now you can call readLine():
    String line = in.readLine();
    Thank you.

  • How can I read "Keys" from a Config File that have square brackets in them?

    I'm using the "Read Key (String).vi" from the config.llb and I'm having a problem because the key names in my file have square brackets in them. I'm creating an VI to read certain pieces of the TestStand �StationGlobals.ini� file and array elements appear as %[0] = "blah blah blah". It looks like they're not getting recognized at all. Is there a way to handle this?

    I was just looking at the code inside the configuration VIs and the way they work under V6 is that the Open VI actually reads the contents of the configuration file, parses it (in nice-platform independent G) and stores it in a fancy LV2-style global called the "Config Data Registry.vi". The routine that does the parsing is called "String to Config Data.vi". My gut reaction is that this code is going to be the same in your version because between sometime prior to V6 of LV, NI changed the location of a couple terminals on the low-level Match String function and it looks like when this code was originally written the terminals were in the old configuration.
    In any case, if your square-bracket containing strings are getting lost, this is probib
    ly where it's happening at. The other place to check is in the read VI itself. The V6 VI for reading the configuration registry is called "Config Data Get Key Value.vi". It's output is then further parsed by a function called "Parse Store String.vi" if the "read raw string?" input is set to False (the default position).
    Given that all the code for these functions are written in LV, you should be able to fix your VIs to read the strings you have in the ini file now. Which IMHO is actually the way they should work.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Maybe you are looking for

  • How do I select a row from the middle of a recordset?

    UserID QuestionID Answered 10 9 N 10 8 N 10 7 N 10 6 N 10 5 Y 10 4 Y 10 1 Y From the table sorted by QuestionID DESC, how do I select the first row from the bottom going up with Answered value equal to 'N'? Which in the example above would be: 10 6 N

  • Has anyone had a problem losing e-mail messages after viewing on the iphone

    Recently, I have lost a small handful of Yahoo messages. Seriously, they just vanished into thin air. The message would be there in my list of messages, but when I would open it on the iPhone, it would be a completely different message. Initially I t

  • Residual Payment Logic

    Hi All, In my project, i want to get the original accounting document no incase of residual payment made for reporting purpose. can anyone tell the logic to get the same? Thanks Lakshmi

  • Opendocument URL with range parameter

    Hi, we are running BO XI R2 with SP5 and have been recommended to switch from the older viewrpt URL functionality to the opendocument URL functionality due to issues with releasing of BOE sessions. We have now written some code and are testing out th

  • What resolution does Pages export Images to EPUB?

    I was wondering what resolution Pages09 Exports images to EPUB (which are then readable in iBooks2?) In other programs from Adobe and others you can control the Image conversion Resolution before you Click "Export" to EPUB?