Using ini-files with write-key/read-key (double) and defined accurarcy

Hello,
in a popup the user can insert a numeric-double-value.
This value is saved in a ini-file using the Write-key-vi with Type = double. Works fine.
What do i have to do to set the values after the comma?
So if user inserts 1,532 i want to round to two digits after comma and save it. (-> 1,53)
Thx
Solved!
Go to Solution.

I don't know how LV deals with different decimal seperators (e.g. comma instead of point), I guess it 'just works' depending on the system locale.
A few different options are available as follows...
The Write Key function has a 'precision' input which will set the number of decimal places to save the DBL to (in your case, set this to 2):
If you are using a numeric field, you can set the 'increment' property with 'coerce to nearest' to prevent them from entering more precision than is available:
The obvious method for post-rounding the input is to scale up the number, round to the nearest integer and then divide again to limit the precision:
I couldn't see anything in the numeric/math palettes that does this.
Certified LabVIEW Architect, Certified TestStand Developer
NI Days (and A&DF): 2010, 2011, 2013, 2014
NI Week: 2012, 2014
Knowledgeable in all things Giant Tetris and WebSockets

Similar Messages

  • Read ini file with multiple threads

    I have a state machine architecture, but I have multiple threads. For instance, one is dealing with listening for mulitple tcp connections and storing their refnums to an array in a functional global. Another thread is accessing these refnums and collecting data it's receiving from each tcp connection. This data is queued up and then dequeued in a third thread which does some modification and sends it out via serial. My question is, when you have a situation like this and have to read an ini file, where should you read it? It seems like the most logical place would be outside your loops so you can get all the tcp and serial info (port, baud rate, etc) then wire it it to your create listener or initialize serial connection despite them being in different threads. But then again, normal state machine architecture would want an "initialize" case. If you did this though which loop would you put the init case in? And you would then have to worry about synchronizing loops becuase you wouldn't want one to try and create a listener while another thread was still reading ini data which would include the port to listen on. Maybe I'm overthinking this haha. Suggestions? Edit: one more question. Does it seem overkill that I have a tcp loop listening for data and queuing it up and a separate loop sending out the processed data via serial? Or should I just have one state that gets tcp data stores it in a shift register, then another state that sends it out via serial, and returns the state machine to the tcp read state?
    Message Edited by for(imstuck) on 03-03-2010 01:13 PM
    Message Edited by for(imstuck) on 03-03-2010 01:17 PM
    CLA, LabVIEW Versions 2010-2013

    Most of the applications I work on at the moment are used for testing barcode and label printers. The test applications I design are focused on testing the printer's firmware, not the hardware. Within our applications we have three primary objects (Unfortunately they are not native LabVIEW objects yet. They were developed before native LVOOP.) The primary objects we use in our applications are a log object, a connection object (communication interface to the printer) and a printer object. In any single instance of a test we only have a single printer, a single connection to the printer and one or more discrete logs. Each instance of these objects represent a single, real physical entity. A singleton object is a virtual representation of the physical world. Let's take the log object since that is the most simple of the objects described above. Naturally for a given log file you have the log file name and path. We also provide other attributes such as the maximum size of a single file (we allow log files to span multiple files), whether it is a comma delimited file or if it contains raw data, if timestamps should be included with a log entry and so forth. Most of these attributes are static for a log file with the exception of the name and such things as whether the logging is actually enabled or disabled. If we split a wire and had multiple instances of the log file (the way native LVOOP actually works) the attribute for whether logging is currently enabled or disabled will only pertain to the specific instance, or specific wire for the that object. Since this truly represents a single item, one log file, we need that attribute to be shared for all references to the instance of the log object. Since we allow this we can set an attribute on the log object in any task and it will be reflected in any other task that is using it. Think of the way a action engine or functional global works. However, in this case we provide discrete methods for the various actions.
    I hope that made some sense. If not let me know since I just whipped up this response.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Memory leakage when using Ini-file VIs

    I'm using the Configuration File Vis to read and write data to different .ini files. The files contain both standard keys and clusters written as a segment using the Open G toolkit. Instead of opening the files and keeping them in the memory of the Config VIs I'm just using them to read and write, decode and encode...the references are all closed using the Close Config Data.vi. The problem is that even though immediately close the config data the application keeps grabbing more and more data...every time a configuration file is open, read or written to and the closed everything from 4K to 50K of additional memory has been allocated by the application (this is a stripped down application that only deals with the config files, so
    there are no other sources for the memory leak).
    Has anyone else experienced this? How can you repeatedly open and close config file slike this without it continoulsy allocating more memory?
    Attached is a copy of the VIs, the directory structure must be kept intact if the ini file is to be read correctly.
    I've been stearing so hard on this the whole day that I might just be overlooking something obvious...
    In the full application the VI init and write operations are only done when the user reconfigures the system, which may be a couple of times per month...so the memory leak would not cause a problem right away, but it would not be healthy to leave it there...
    MTO
    Attachments:
    Memory_Leak_Demo.zip ‏1391 KB

    Could you post a 6.1 version?
    LV7 is still about two weeks away for me.
    Does the problem show up in 6.1?
    I ran across an error while writting to a FP output that was not configured that would cause a "drop of memory" to leak every time the VI performed the write. The leak did not show up in the profiler but windows would show te memory foot print growing continually as long as the writes continued. The work around was "don't do that!".
    I bring this up because I found and reported this just prior to LV7 release and the featur may still be present in LV7. I also believe that Jean-Pierre used a "write and check" metod to detail with the unknown data types of of complex data structures.
    If you just read does it leak?
    If you just use simple data types do
    es it leak?
    Is the ini file growing?
    I really appreciate the effort you have been putting into the Dev-Exchange Mads! I wish i could do to more to help.
    Keep us posted.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to use .keystore file with BEAweb 6?? Help

    Hi,
    Is there a way to use .keystore file with BEA Weblogic 6 or 6.1 ?
    I used keytool to create private key and public key..
    I do not know how to tell weblogic 6 to use it....
    Can this be done through the GUI or do I have to add something to the .xml
    config file for the site?
    Thanks,
    Rob

    "Bobby Digi" <[email protected]> wrote:
    Hi,
    Is there a way to use .keystore file with BEA Weblogic 6 or 6.1 ?
    I used keytool to create private key and public key..
    I do not know how to tell weblogic 6 to use it....
    Can this be done through the GUI or do I have to add something to the.xml
    config file for the site?
    Thanks,
    Rob
    nope. with 7.0 you can do that.
    >
    >

  • Using ditaval files with XML Author

    I've been evaluating XML Author and am trying to determine how to use ditaval files with it. If I want to save a ditamap as a book for PDF creation, the Prompt for DitaVal File check box is greyed out. Does anyone know why this might be the case? Is the use of ditavals limited to a full implementation of FrameMaker?
    I tried adding PromptForDitaval=1 to the [General] section of the ditafm.ini file to no avail.

    Make sure you are using the latest hotfix for Director (11.5.8) - it is the first to support AS# in Flash. Your SWF members will probably need to be linked to their external files instead of fully imported.
    Or perhaps you're saying that you've met both these conditions and are still seeing problems?

  • How to use "choose file with prompt" command?

    I need to use "choose file with prompt" command and I want give user possibility choose ONLY images (jpeg, png, gif). So, I write like this:
    choose file with prompt "Please, choose images for processing..." of type {"JPEG Image"}
    But this doesn't work! - All files (including jpegs) are dimmed, and user can't choose any....
    So, how can I filter JPEGs, PNGs and GIFs?

    I have found, that most of images on my computer has missing file_type, I don't know why..... so "type identifier of (info for (choose file))" also doesn't work properly.
    The only one way that 100% works is use Uniform Type Identifier (UTI) -- details here: http://www.huw.id.au/code/fileTypeIDs.html
    thanks.
    iMac G3, PowerBook G3 FW   Mac OS X (10.4.5)  

  • I am trying to integrate simulink model (.mdl) file with SIT of Labview for RCP and HIL purpose. I am using Labview 8.6, Simulink 6.6 with RTW 6.6 and RTW embedded coder 4.6 ,Visual C Express 2008 and Visual C++ Express 2008.

    I am trying to integrate simulink model (.mdl) file with SIT of Labview for RCP and HIL purpose. I am using Labview 8.6, Simulink 6.6 with RTW 6.6 and RTW embedded coder 4.6 ,Visual C Express 2008 and Visual C++ Express 2008. I have selected system target file as nidll.tlc,make command as make_rtw and template nidll_vs.tmf. When I try to generate .dll file I get the following error.
    Attachments:
    SITProblem.JPG ‏101 KB

    Hi,
    No . I could not solve the issue. Presently we are using microautobox (from Dspace)for doing the RCP.
    Himadri 

  • Hi, I am using USB 8476s to communicat​e to a slave unit in LIN network using LabVIEW7.1​. Can anyone tell me how i can send a header file plus 1 byte of data to the slave in a LIN network. or how do i use ldf file. i want to read responses from the slave

    Hi,   I am using USB 8476s to communicate to a slave unit in LIN network. Can anyone tell me how i can send a header frame plus 1 byte of data to the slave in a LIN network. or how do I communictae with slave using LabVIEW7.1.
    I want to read responses from the slave. When i tried with labview exapmle programs or even using MAX also, while doing some switching action in my slave, i am getting response as Device inactive with timestamp but there is no data format. 
    And I have Lin Description File. Can you suggest me how to use ldf file.
    I am at customer place and It would be great help from you if you can suggest me at the earliest. Thank you

    you may use the LDF Starter Kit to use LDF informations in your application
    http://joule.ni.com/nidu/cds/view/p/id/665/lang/en

  • How to configure the .ini file with applet

    hai
    i am using native methods in that methods they use some ip addresses. when i am using that native methods in applet run the applet using appletviewer tool it works fine but when i am open that applet using html page browser not configure that .ini file data .how to configure that .ini file with browser

    Hi Jay SenSharma,
    Thanks for your immediate response.
    I saw your URL links, But in your link give the recursive deployment using wlst. But my question is how to configure the oracle weblogic library files into Admin server & Managed Servers by using the wls.jar file through wlst script to create the new domain.
    But if create the new domain by using GUI mode then we manually give the admin server port number & managed servers port number and name.
    By default the library files are configured with the Admin server in GUI mode. But the Managed server the Library files are not configured with the Managed servers. Then we manually select all the library files to the corresponding managed servers. Then only the applications are deployed into the corresponding managed server.
    Regards,
    S.vinoth Babu

  • Using *.so files with eclipse

    Hey there
    I'm having a little problem compiling an application which uses *.so files with eclipse:
    If I run eclipse from the directory in which the *.so files are present, the application will run.
    However, if I run eclipse from any other directory , the applicationwon't run, stating that the *.so were not found.
    I've placed the path to the directory on my $PATH , and tried to add the following line to the VM variables in the RUN menu:
    -Djava.class.path=<directory _name>
    but to no avail..
    Any ideas?
    Thank You!
    Message was edited by:
    Yossale

    I added it to the LD path, but nothing changed.
    How can I check if eclispe picked up the change?First check that you can now run your program from any directory and then worry about Eclipse.
    Where did you setup the LD_LIBRARY_PATH?

  • How to use XDCAM files with Premier 4 Trial

    According to everything I have read, using XDCAM files with Premier 4 is easy. It just works. However, it doesn't with me.
    For starters, when I create a new project, there are no XDCAM presets, despite it stating there are in the various documents I have read.
    If I either try to import a file directly or copy it to the hard drive and then import it, I get:
    Error Message
    The importer reported a generic error
    Not very helpful.
    This is a trial version of Premier to try to establish if this product is any good. I did try to contact Adobe but they say they don't support trial users. Not very helpful. Since Adobe are obviously not very interested in selling their products, is there anyone else out there whop can answer this or should I just use Final Cut Pro instead (well if Adobe are not interested in helping a potential customer, what chance is there of being helpful once they have your money???)

    As far as I am concerned, editing XDCAM EX files with CS4 - I have yet to edit XDCAM (HD) files - is as easy as editing DV(CAM) material on my i7 Extreme machine with Vista Ultimate and 12 Gig of RAM.
    I am also pleased to report that the audio bug that beset CS3 when editing XDCAM EX files namely, audio cutting out randomly, is a thing of the past.
    The whole CS4 Suite (including Premiere) has been running very smoothly on my (beefy) machine.

  • "Use RAW files with external editor" greyed out for Photoshop CS2?

    I've just upgraded from iPhoto 5, and the "Use RAW files with external editor" option in the advanced preferences is greyed out when I select Photoshop CS2 as my external editor (back in the General pane).
    It works fine when Preview.app is selected. I can understand that pre-CS2 Photoshop wouldn't be available, but CS2 is capable of editing RAW images.
    Has anyone been able to get iPhoto 6 to send a RAW image to Photoshop CS2 using this preference? I've written an Applescript to do it in iPhoto 5, but I'd rather use something cleaner...
    15" PowerBook G4   Mac OS X (10.4.4)  

    Works great with Photoshop Elements, opens with Camera Raw. The issue is you can't save it so that iPhoto gets the changes.
    You have to save it and then re-import. I tried all permutations of saving it in originals and modified folders in the library. No luck. The only thing I didn't try is to save it as a jpeg over the top of the full sized one iPhoto created on import.

  • Cannot open project file with write access...

    I have seen that this problem has been reported before but have yet to find a solution.
    I have my project file in an external hard drive.  When I plug the hard drive to another computer and want to save it I get this message:
    "Cannot open project file with write access.  The file may be locked or you don't have permission to write to this location.  Select Save As..."
    I don't want to Save As because other projects make reference to this file and also my Encore file will be messed up.
    FYI both computers use Windows 7.
    Any solutions?

    Right click on the folder in Question and select properties. Then select the security tab. Make sure you add everyone to the user list. You do that by selecting edit and then add. Type in everyone in the object section and hit ok. Then select the everyone user and checkmark the Full control. Hit Apply and it will adjust the permissions for the folder and subfolders and files.
    Eric
    ADK

  • Can I batch print PDF files with Adobe Acrobat Reader X

    can I batch print PDF files with Adobe Acrobat Reader X?  I have tried from Windows Exploer (Windows XP) and it looks like the files are opening but they do not print.
    Pat

    Very strange!  What is your installed Reader version?
    Try disabling Protected Mode in Adobe Reader [Edit | Preferences | Security (Enhanced)].

  • Using Word files with audio on a PC

    I was wondering if it were possible for one to use Word files with recorded audio from a Mac on a PC? I'm not sure if it is possible at all, but if somebody knows how to extract the audio, it would be a great help. I used Word 2008 for the Word files.
    Thanks

    If you don't get an answer here, try the forums devoted entirely to the problems of MS apps:
    http://answers.microsoft.com/en-us/mac/forum/macword

Maybe you are looking for

  • Dump EXPORT_TABLE_UPDATE_CONFLICT occurred during setup of statistical data

    Hi Experts, I scheduled the run of statistical data setup for SD-Sales Orders. But the following Dump screen has occurred: Runtime Errors         EXPORT_TABLE_UPDATE_CONFLICT Date and Time          09.09.2011 10:03:09 ShrtText      Problems found dur

  • Music on old computer

    Help, i have some folders on another computer what is the best way to transfer them to this computer

  • Some problem using in this function!!!

    Is it valid to write a function like this?? CREATE OR REPLACE FUNCTION dept_dtls(DEPT_ID IN VARCHAR2) RETURN record is DEPT EMPLOYEE.DEPT_ID%TYPE; STATUS RECORD; BEGIN Select COUNT(DESIGNATION), into STATUS from EMPLOYEE where DEPT=DEPT_ID GROUP BY D

  • License to use JS generated by DW?

    I know this sounds crazy, but a client is asking for a license agreement that shows that they can use the rollover javascript that is generated by Dreamweaver in a website that I built for them. I have worked for huge corp clients before and never ha

  • Screen just flickers when try to start an app.

    I have updated my iPad 2 software. But now when I try to open an application the screen just flickers as if to open the app but then just goes back to the normal screen without opening the app. Any suggestions?