How do I replace a single record in a logfile?

I'm developing a program that saves data to a logfile containing clusters. Every record (cluster) contains data from the tested item. The item can be as many as 400+. The file refnum is opened during the whole test. If the test of item 50 (this will be record 49) failed and needs to tested again I want to replace position 49 (counting from zero) with the "correct" test result, but LabVIEW insists and writes them as record 50 and thus item 50 has records as: 49 (failed; want to delete this) and the correct record 50 (this should be record 49 though...). I thought one should connect the "pos offset" at the desired place where the record should be stored in, but one can't connect to that when using datalog file... . I've also
tried to use the "seek"-vi to position the refnum at the desired location but it ignores it... . What shall I do? I have a working "viewer" for my log-files so they aren't corrupted, everything else is OK. Any suggestions?
//Anders Boussard

You do not have to use dataloging, you can write the data directly to disk. Writing to a file in binary is much less structured than datalogging but gives the flexibilty of overwriting records. With binary files you can even write several groups of data at a time so the limiting factor tends to be the speed of your harddrive. Consider using the intermediate file write VIs. As an test, I was able to write different clusters of an arrays having different lenghts to a file and read them perfectly. If your data is of uniform structure, you will have no problems doing the same. Look at the read to binary file.vi and write to binary file.vi for example code to get started. You will have to experiment to get the hang of it.
Chapter 13 of th
e LabVIEW User Manual discusses how to do file I/O and you can also find example code and tutorials on our website.
Jeremy Braden
National Instruments

Similar Messages

  • Any clue how to add pagination to single record form?!

    Is there any1 who tried to create pagination to single record form?! i tried this but i have problem with navigating to the NEXT record.
    Regards;

    Hello guys?!!
    Is there any1 in this forum can help me in my issue?!! am desperate.

  • How do I replace a single instance of a string?

    I'm trying to replace a certain string in a text file. The problem is, there is other data in the text file that is being affected by the replace() function, since replace() replaces each substring that fits the pattern it's looking for. I want my replacement function to target one single instance of something, at one specific instance, and to leave the rest of my text alone.
    Any thoughts on how I'd do that?

    I don't see how to do it with a String direclty without making silly copies.
    But it seems you could use a StringBuilder and its method replace(int start, int end, String str).
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html#replace(int,%20int,%20java.lang.String)

  • How to Enable a Selected single record from Table control...

    Hi,
    I have 5 records in my table control and in screen Painter in Made all the fields in Table control as Output field.
    and  successfully all my Table control fields are disabled...
    Now Now i want to enable the record which i selected n rest all the 4 records should be in Disable.
    what i did is:
    in PBO.
    loop at itab into wa with contol TBC1 .
    Module XYZ.
    endloop.
    Module XYZ.
    loop at screen.
    if screen-group = 'x'.
    screen-input =  1.
    modify screen.
    endif.
    End Module.
    Please help me....
    Thanks,

    hi
    in the layout of the screen u might have dragged and dropped the table control
    double click on it u will get attributes screen in that u select MULTIPLE or SINGLE under Line-Selection
    under attributes tab based on ur requirement.
    table control declaration:
    controls : control type tableview using screen 8000.
    the internal table in table control must be like
    data : begin of itab occurs 0,
    empno type .......,
    empname......,
    empcity.....,
    check(1), " for tab selection"
    end of itab.
    data : itab1 like itab occurs 0 with header line.
    data : flag.
    data : wk_init type i.
    data : lines type i.
    in the attributes screen of the table control
    pass the value ITAB-CHECK to the field W/SELECTION
    in SE51
    PBO
    Module_status_0800
    loop with control table_control_name.
    module_fill_tcontrol.
    endloop.
    PAI
    Module_user_command_0800
    loop with control table_control_name.
    module_read_tcontrol.
    endloop.
    in se38
    Module_status_0800.
    describe table itab1 lines lines.
    control-lines = lines.
    endmodule.
    Module_fill_tcontrol.
    describe table itab1 lines wk_init.
      if wk_init is not initial.
        read table itab1 into itab index control-current_line.
      endif.
    for enabling a row in the table control:
    if sy-ucomm = 'EDIT'.
        loop at screen.
          if flag is initial.
            screen-input = 0.
          elseif ( flag eq 'Y' ).
            if  ( ( screen-name = 'ITAB-EMPNO' or
                    screen-name = 'ITAB-EMPNAME' or
                    screen-name = 'ITAB-EMPCITY' )   
              and control-line_selector eq itab-check
              and control-current_line le lines ).
              screen-input = 1.
            else.
            endif.
          endif.
          modify screen.
        endloop.
      endif.
    endmodule.
    Module_read_tcontrol.
    READ TABLE itab1 INDEX control-current_line.
    IF sy-subrc EQ 0.
    MODIFY itab1 FROM itab INDEX control-current_line.
    ELSE.
    MOVE-CORRESPONDING itab TO itab1.
    APPEND itab1.
    CLEAR itab1.
    ENDIF.
    endmodule.
    module_user_command.
    case sy-ucomm.
    when 'EDIT'. -
    > Function Code assigned to the pushbutton to enable the field 
          flag = 'Y'.
    endcase.
    endmodule.
    Regards
    Murali.M

  • How do I query a single record from a database?

    I need to retrieve a record from a specific table within a .mdb file using it's name or primary key to search.
    I have the database connectivity toolkit(LV7.1) and have not been able to figure this out.
    Any help would be greatly appreciated.
    Jim

    Bdougr,
    Thanks for the reply, but it's a little over my head.
    Maybe I should give some more info. We store test parameters in a MSAccess database.
    Using LabView 7.1, I would like to retrieve a "record" or row based on a primary key (our part#)from a .mdb file and then use that data as my test parameters, I do not want to use the row# or record#. The database contains several tables so I also need to get to the specific table.
    I have figured out how to get a "feild" or the hole thing but I don't know how to return just one specific row.
    I have tried Select data, Fetch, Fetch all and Execute query VIs without success. Would "Execute query" be the way to do it? If so, what would be the correct SQL syntax to retrieve a record base on its primary key?
    Jim

  • Using channel view, how to periodically log a single record to file

    I don't have a problem logging data from nican 2, but I can't figure out how to grab a single 1-dimensional array at a user selected interval and write it to a spreadsheet file.

    Hi Mike,
    This seems more like LabVIEW programming, than CA N communication. I assume you are getting your CAN data using the Channel API CAN Read.vi using the Multi-Channel Multi-Sample data type.
    You need to retrieve the single channel data for the 2D array. You can use the index array VI in the Array function palette.
    With a 1D array you can then use the Array to Spreadsheet file VI in the File I/O function palette. This VI also accepts a 2D array to log all the information.
    A good resource for this type of questions is the LabVIEW support site. Click on LabVIEW Tutorials and Example Code >> Fundamentals. You'll find links to tutorials and examples for File I/O and Array and clusters.
    Hope this provides some help.
    DiegoF
    National Instruments.

  • Iweb 08 - how can i replace a single published page with an updated page?

    At the moment, I find that I have to publish all four of my sites everytime I make a change to a single page.
    Is there a way I can publish a single webpage and replace it via the ftp?
    I'm sure I'm doing this wrong but can't seem to figure out why.

    See Chapter 2 here.

  • How do I replace one ' (Single Quote) with '' (Two single Quote)

    Hi,
    I have been surfing around the forum, coudn't find the similiar case.
    I have been trying but fail. Below is my code:
    activity = request.getParameter("activity");
    activity = activity.replace("\'", "\'\'");
    Error Occur:
    Incompatible type for method. Can't convert java.lang.String to char. activity = activity.replace("\'", "\'");
    I'm trying to use replaceAll(), but seem like the method is not existed, we are using Version Java 1.3
    Pls advise.
    Regards
    Ying

    For JDK 1.3 or ealier, use this:
      public static String replaceSubstrings(String str, String sub, String rep){
        int s, p, q;
        int slen = sub.length();
        StringBuffer sb = new StringBuffer();
        s = 0;
        p = str.indexOf(sub);
        q = p + slen;
        while (p != -1){
          sb.append(str.substring(s, p));
          sb.append(rep);
          s = q;
          p = str.indexOf(sub, s);
          if (p != -1){
            q = p + slen;
        sb.append(str.substring(s));
        return sb.toString();
    activity = replaceSubstrings(activity, "'", "''");

  • Presenting in single record

    Hi,
    How the header record and item record which comes from LO extraction showing as single record.
    I mean let us say, 2lis_11_vahdr extractor contains header level information and 2lis_11_vaitm contains item level data when loading both into INFOCUBE, How it is clubbing into single record?
    Header won't contains Material Numbers and Material Item Numbers,so when you load header and item data into same cube, its going to be loaded as another record because it has item numbers.
    I know if the level of information is same we can show as single record when you do compression. But here the granularity of data is different.
    Could you please provide the information

    Hi Harsha,
    You are right, hence I think, the standard(business content) flow as well stages the data first in the DSO which would with its overwrite mechanism create a single record with header and item details, this is then further moved to the cube.
    However if you choose to load data to a cube directly from the data source, then you will not see the record consolidated if you drill down on item level char.
    Hope it helps,
    Best regards,
    Sunmit.

  • Single record in a multi record block

    How do I disable a single record in a multi record block keeping only the display option in Forms 4.5

    you can't in 4.5 you can do it in 6.0 with the set_item_instance_property.

  • How to use execute query For a single record

    Hi All,
    I am working with oracle forms 10g, I have developed a custom form.
    I the form user enter some data and click save in the menu and data get inserted into my table. Inside the insert statement i have hardcoded some values, Once data get inserted i cant able to see that values immediately in my text fields in my form.After requerying i can able to see the changes.
    For example I have a text field called Status, and the field is display only field. At that time of insert i have hardcoded as "INCOMPLETE". Once the user enter the data in the form and click save the data get inserted in to my table but i cant able to see the status, after i requery my form i can able to see the status.
    Here i do multi insert also.
    This is my insert statement
    BEGIN
    First_Record;
    LOOP
    IF :BANK_GUARANTEE_BLK.CHECK_IN_OUT = 'Y'
    THEN
    XXBANK_GUARANTEE_HEADERS.XXBANK_GUARANTEE_INSERT;(this is my package, here i have written my insert statement)
    --Execute_query;
    END IF;
    Exit when :System.Last_Record = 'TRUE';
    Next_Record;
    END LOOP;
    END;
    If user insert only one row and i gave Execute_query to refresh and bring the current data, but when i use execute_query Its brings up all the datas in the table.
    Can any one tell me how to avoid this and how to use execute_query for a single record.
    Thanks &regards
    Srikkanth

    Solved,
    The solution is
    set_block_property('LC_REQ_BLK',ONETIME_WHERE,'LC_PO_NUMBER='||:LC_REQ_BLK.LC_PO_NUMBER);
    go_block('LC_REQ_BLK');
    execute_query;
    Works fine.
    Regards
    Sri

  • How to insert sales text (MM02) into a single record of a Ztable.

    Hi,
    I'm extracting data from different data base tables and populating a Ztable which has Matnr as primary key and sales text as a field.
    I have already used READ_TEXT to display the text and it is displayed in multiple records which in turn leads to duplication of Material numbers.
    Now I want to avoid duplication of records (Matnr) as this being a primary record, and display the sales text of a particular material number into one single record.
    Can anyone tell me how to insert sales text (MM02) transaction into one single record.
    Thanks,
    Govind

    sorry i am not enough clear about your requirement...
    as i can understand i am explaining to you.
    suppose your itab contains repaeating matnr.
    matnr
    1
    1
    2
    2
    2
    3
    3
    like this.
    data : text(200),
             matnr like mara-matnr.
    loop at itab.
    call READ_TEXT fnmodule.
    loop at tline.
    concatenate text tline-tdline into text.
    endloop.
    matnr = itab-matnr.
    at end of matnr.
    itab1-matnr = matnr.
    itab1-text = text.
    append itab1.
    clear text.
    endat.
    endloop.
    NB change the code as per your requirement
    regards
    shiba dutta

  • How can I map last of the repeating records into a single record?

    I have a following input schema, I need to take only one of the <Student> records and map that to a single record in output. Doesn't matter if the first, second or last one of the records get mapped, I only need one in the output. Any idea how can
    this be accomplished?
    Input:
      <Students>
        <Student id="1">
            <Name>
              A
            </Name>
            <Roll>
              1
            </Roll>
        </Student>
          <Student id="2">
            <Name>
              A
            </Name>
            <Roll>
              1
            </Roll>
        </Student>
        <Student id="3">
            <Name>
              A
            </Name>
            <Roll>
              1
            </Roll>
        </Student>
      </Students>
    Expected Output:
    <Candidate>
      <Student>
        <Name>
           A
        </Name>
      </Student>
    </Candidate>

    Sounds rather complex for something that could be done very simple in custom XSLT like this:
    <?xml version="1.0" encoding="utf-16"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="Students">
    <Candidate>
    <Student>
    <Name>
    <xsl:value-of select="Student/Name" />
    </Name>
    </Student>
    </Candidate>
    </xsl:template>
    </xsl:stylesheet>
    Morten la Cour

  • How do I find & replace a single character?

    Am using Adobe Acrobat Pro....
    The find/replace box pull down has "Whole Words Only" checked and I cannot uncheck it.  How can I find and replace a single character throughout a document?

    That's just how it works. You can "find" anything, but you can only "replace" whole words. As soon as you click to open the "replace" section of the dialog the search settings are locked into their basic states, even if you don't enter a replacement string (but that part's a bug).
    The simple answer is that you cannot replace all instances of one character using Acrobat's inbuilt tools. You're expected to edit the document outside of PDF and recreate it.

  • How to make a single record datablock?

    Hi all,
    I got a data-entry form (9i) that will input a record one at a time and commit before entering another record.
    I try to set the block as single-record to yes but it gives error, and after checking with help, I understand that it can not work with database data block.
    Is there any idea on how to make the data block to show only one record? The problem is that after entering some data on the record, sometime the data-entry clerk may push the arrow-key that make form shows the next record items, which will be empty, and this will confuse the clerk!
    Thank you for your help.

    Add Triggers KEY-UP(DOWN, NXTREC, PRVREC...) to the following effect:
    NULL;
    or
    NEXT (PREVIOUS) _ITEM;                                                                                                                                                                                                                            

Maybe you are looking for

  • Imesh has taken over. Wont get out. Has taken over my homepage.

    I downloaded imesh to get access to more music. It has now taken over my computer like a virus. I have w XP and have removed it out of the add/remove section of the computer. CNN is my homepage, but since downloading It, cannot get my hompage back. E

  • Client tracking in WCS

    I have a wcs and found how to do rogue AP location tracking, but i haven't figured out if it is possible to show the location of a legitimate client connected on the network, without having a Cisco Location Appliance. Is this possible?

  • Using ADODB library in labview Activex

    I created an executable and an Installer of a VI which uses ADODB library on a computer which had VB installed on it. I installed this on a computer which did not have VB installed on it. After installing i got the Activex object "Microsoft ADO Data

  • Is it true that iphone 3gs can only be sync to one computer?

    hi,iam trying to

  • Get portal users

    Hi, We are developing an abap program that need to get a list of sap portal users. With the configuration we have on our sap portal, the portal users aren't the same as R/3 users, therefore, portal users are independent of sap R/3 users. Another opti