How to acquire serial data on a digital input line with good performance?

Hello,
we have a performance problem with our realtime controller. Our objective is, to read a 24-bit long digital waveform from a digital input line. To do this, we supply a clock signal (236 KHz)  to the PFI1 Line of our DAQ Board. On each rising edge of the clock, a new bit is set on the digital input DI0.
Our hardware which transmits the data, is triggered through a digital output from our realtime controller. On each edge on this output, the hardware starts a serial transmission of 24-Bits.
Everything works fine except the bad performance of our realtime controller. We want to acquire the 24-Bits in a 1ms timed loop. To measure performance we wrote a test program. In that, we only triggered the hardware and transfered the data to the realtime controller. The task which is doing this job, has a approx. CPU-Load of 30%, which is, in my humble opinion, very high. The task is not waiting for data or anything else! We have earlier implemented a control which is also using a 1ms timed loop. This control is sampling 2 analog input signals, 2 counters. Futhermore it's sending telegrams with CAN and doing many calculations. The strange thing is, this much huger program has a CPU-Load of 25%. Does anybody know where the problem is?
For the better understandig I attached our test-program to this text.
We're using:
PXI-8175 realtime controler
PXI-6221 Multifunction DAQ
Thanks!
Regards, 
   Crest!
Attachments:
dig_test.zip ‏51 KB

Hello,
First of all 30% CPU-Load is normal because the DAQmx-driver needs a lot of resources.
In your programm you should place a wait (for example with 1ms) into the while-loop which causes
lower CPU-Load.
If this is not enough you should build your vi like in the following example.
Regards,
Christian
Attachments:
Read Dig Port.vi ‏51 KB

Similar Messages

  • How can i use in the same time input line and mic to recorder in several track whit SONAR

    I have beem recording only input line because SONAR 4 not recognized the mic in, Help me!!!.
    Thank you. Sorry for my english

    LIMACAR wrote:
    How can i use in the same time input line and mic to recorder in several track whit SONAR 4. I have beem recording only input line because SONAR 4 not recognized the mic in, Help me!!!.
    Thank you. Sorry for my english
    Depending on which soundcard you have there, but if your card is capable for
    ASIO -> activate I/O drivers on Sonar/Options/Audio/Drivers -tab (mic/line sources should be listed there --> activate) and select the mic or/and Line sources on tracks "I" - dialog
    WDM/KS -> use the Surround Mixer or windows recording controls for recording source selection (mic should be listed there)
    MME32 - > same w/ WDM/KS
    If you use Asio4All --> same w/ WDM/KS & MME32
    No mic and line source simultaenously w/ WDM/KS and MME32.
    You perhaps be able to do this w/ kX drivers.
    jutapa
    ADDED:
    You can also install modded version of Audigy 2 drivers/software but I have never done this w/ Li've! 5. so I can't be sure if you get ASIO support for your card.
    Here are the instruction --> http://www.tech-pc.co.uk/audigy-2.php
    jutapaMessage Edited by jutapa on 05-25-2006 02:48 PM

  • How To Managed Serialized Data Over Multiple Application Versions

    Lately I've been struggling with deciding how to deal with serialized data between application versions. Assume you have some software that has to be able to save data files. As the application evolves, the data format changes. The application needs to be able to load data saved from prior application versions.
    When I first started out I just used a Serializable class. It was quick and easy. However, as newer versions used slightly different data formats, I had to come up with a means to upgrade the data to the latest version. Initially I created a process where the latest data class knows how to upgrade from prior data class versions. Then, when loading data in the application, if the class doesn't match the latest data class version, it checks to see if it matches one of the versions that can be upgraded.
    This sort of works, but still has one glaring problem. The old data classes must be etched in stone; never altered. For ever and ever. You can get away with certain simple updates to older data classes by defining a serialVersionUID and keeping it's value the same. But this doesn't always work. What if my overall package structure changes? I have to ensure that the old data classes remain in the same older package structures. Not ideal.
    So I've started considering other ways to serialize data...a process where the data can be broken down into core Java classes. There are serializers for serializing to XML, but I don't feel that XML is an appropriate storage format for the data. I'm also considering using a custom built serializer that uses introspection in some fashion.
    Before I go any further, however, I'd like to solicit some suggestions. Do you know of any serialization packages that might help me? Do you have any suggestions on what might be a good custom solution? Will Externalizable make this easier? (I've never used Externalizable before...looks like maybe it could help, but even that appears to be vulnerable to refactors that change package structure).
    Thanks for your thoughts.

    I've continued to work on my own custom serialization process as described in my previous post. Here is how it currently works:
    In the example there is a class named ExampleSubClass identified by the String "xsub" of version "1.0". It is saved and then reloaded into a class named RevisedExampleSubClass identified by the String "xsub" of version "1.1". The String "xsub" identifies what the class represents, which allows the class and package to change as needed. Fields can be added, removed, or converted through the optional serialConvert method.
    public class ExampleSubClass extends ExampleSuperClass {
         private static final String serialId = "xsub";
         private static final String serialVersion = "1.0";
         ExampleAggClass exNullAggClass = null;
         String exString;
         ExampleNonXCSerialClass nonXCSerialClass;
         String exNum;
         ExampleAggClass conAggClass;
    public class RevisedExampleSubClass extends ExampleSuperClass {
         private static final String serialId = "xsub";
         private static final String serialVersion = "1.1";
         ExampleAggClass exNullAggClass = null;
         String newStringA;
         String newStringB;
         String exString;
         Integer exNum;
         ExampleNonXCSerialClass nonXCSerialClass;
         String conAggString;
         private void serialConvert(Converter converter, String fromVersion) {
              if (fromVersion.equals("1.0")) {
                   converter.addField("newStringA", String.class, "new string!");
                   // intentionally not adding newStringB to see if warning is thrown
                   converter.convertField("exNum", new ConvertScript<String,Integer>(String.class, Integer.class) {
                        @Override
                        public Integer convert(String fromValue) {
                             return new Integer(fromValue);
                   converter.convertField("conAggClass", "conAggString", new ConvertScript<ExampleAggClass, String>(ExampleAggClass.class, String.class) {
                        @Override
                        public String convert(ExampleAggClass fromValue) {
                             return fromValue.getAggString();
    // and then in some other class...
         ExampleSubClass example = new ExampleSubClass();
         System.out.println("Serializing class...");
         XCObjectOutputStream xcoos = new XCObjectOutputStream(new FileOutputStream(file));
         xcoos.writeObject(example);
         xcoos.close();
         System.out.println("Deserializing class...");
         XCObjectInputStream xcois = new XCObjectInputStream(new FileInputStream(file), RevisedExampleSubClass.class);
         RevisedExampleSubClass resc = (RevisedExampleSubClass) xcois.readObject();There is still a little more work to do to fully support arrays and collections, and I need to develop a rigorous test suite for it. But so far it's looking good.
    Edited by: Skotty on Jul 18, 2010 5:31 PM

  • How to acquire 1 data point per trigger ?

    Dear all, anyone can help me in acquiring 1 data point per trigger? just as a Sample/hold circuit?
    I changed the example from Labview "Acquire 1 point digital trig", however, it doesn't work, it says data acquiring is inconsistent with buffer. The program is attached.
    and I try to use "AI Sample channels.vi", but there is not trigger input and sampling rate input.
    Thank you very much for your help.
    Attachments:
    Acquire1PointTrig.vi ‏81 KB

    There is a good example that can do almost exactly what you want to do.  It is called Acq&Graph Voltage - Int Clk - HW Trig Restarts.vi.  There are only three things you need to change.  Change the triggering VI to trigger off of a digital signal, then change the read VI to read a single channel and single sample and finally, change the Samples per Channel to 2.  I have included screenshots of the VI.
    The VI works by setting up a digital start trigger that is retriggerable, so that you can have this trigger start the acquisition over and over.  Once the trigger happens, a sample is acquired, read, and then the hardware waits for another trigger.
    Have a great day,
    Brian
    Message Edited by Brian C on 03-28-2007 01:48 PM
    Brian Coalson
    Software Engineer
    National Instruments
    Attachments:
    block diagram.Jpg ‏54 KB
    front panel.Jpg ‏58 KB

  • How to give delay in switch on digital output lines

    Hello All,
    I am working on PCI-6514 Digital IO card, I am writing a sequence to my application using DAQmax for  Digital input and output lines
    I want to switch on one output line0 and after a delay 5sec switch on line1 output and after a delay of 3sec switch on line2 output and sense input line 0 and line 1 .
    How can we know the status of output ie output is on or off.
    Since i am using the IO card for first time suggest me in this.

    Hi
    I am going to assume that you are using LabVIEW 7.1 for this application.  If you are trying to acquire data from an external device after outputting data to that device, the DAQmx tristate property node will give you this functionality.
    You will then need a DAQmx write.vi to output your digital data followed by a DAQmx channel property node. Select Digital Output>>Tristate on the property node and wire a true constant into it. After the property node, you can use a DAQmx read.vi to read the data coming into the digital lines. By using the tristate property node, you can avoid stopping the digital output task and starting an entirely new task.  I am attaching an example program that will demonstrate this.
    Regards,
    Hal L.
    Attachments:
    digital input and output.vi ‏39 KB

  • How does NI 9411 card convert the digital input pulse given to output rpm?

    I am measuring the shaft rpm using the encoder and feeding it to the 9411 card.Can the 9411 card display the shaft rpm? How the card can do this conversion?Should I use any other component to decode the digital input pulse?

    Have you tried enough searching, here and there...??
    1. Check page # 12 of this manual.
    2. How Do I Use a Quadrature Encoder with My Data Acquisition Board?
    3. Encoder Measurements: How-To Guide.
    Edited:
    4. NI 9411 Pinout.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • How to visualise continues Data aquisition from a PCI 6602 with 2121 BNC connector board in C++ ?

    Hello everyone,
    We are trying to get on the screen the aquired pulses from our  PCI 6602 with a 2121 BNC connector board, from several devices. We are able to read the data and save without problem, but we cannot look at it while we are measuring. Anybody has an idea to how program this in C++ ? Any suggestion is welcome!
    Thanks for the help

    Hi,
    try to look for some example programs and Tutorials:
    Examples Results
    http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav:ex/q/DAQmx%20C%2B%2B/...
    Tutorials Results
    http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav:tu/q/DAQmx%20C%2B%2B/...
    You should also have a look at the "C Reference Help" which is installed with the NI DAQmx driver.
    Acquire N Scans (Visual C++ 6.0, CW++, NI-DAQ)
    http://zone.ni.com/devzone/cda/epd/p/id/207
    Continuous Analog Acquisition with Producer Consumer Architecture in C#
    https://decibel.ni.com/content/docs/DOC-4253
    Good Luck!
    Matteo

  • How to get ALL data from ipod to new computer with itunes??

    I have a ipod touch 2nd gen. I have cd's and purchased songs on my ipod. I did use itunes on my friends computer for a number of years but now I've got windows 7 computer and i have downloaded itunes but it won't let me transfer current data on my ipod to itunes without me loosing it all. I can only access itunes at friends now. Is there any way to get all my songs, playlists, apps (with data still on it) and photos without deleting it? I am looking for the cheapest way possible. I have tried downloading copy software but it all costs money. Thanks

    See:
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities
    Sync Your iOS Device with a New Computer Without Losing Data - How-To Geek
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • How can I pre-populate a web app input form with data from a webform in the CRM?

    Scenario:
    A customer fills a registration webform. The customers data is stored in BC CRM as usual. This step provides a lead to marketing unit and the team makes a follow up. Upon completion of internal processes. The workflow initiated by this customer filling the registration form is approved.
    Th user is sent a 3rd-party notification with a url to enable the user complete the registration process by entering the information into a web app.
    The Issue:
    The client is requesting that he doesn't want the the customer to re-enter some of the  information that  has been captured in the registration form again since it will be laborious for the user to do this. He wants the system to store this customer data already in the CRM and pre-fill the web app form so that the user just submit the data, so that the item can be in the appropriate web app as web app item.
    Question: Is this possible? Can this be achieved via js. How should I go about it.
    Your assistance will be appreciated.
    Thanks.

    For each option you would need to only have a custom text field for that item. This is where the otpion for each gets populated with javasript.
    Each option is your own html that is a select with options as web app items. A list layout of your web app items is just a select with text and value of that item.
    Your tricky thing is to setup the matrix of rules to define what shows and when. You can do that with data source association between web apps if it is a 1-1 relationship but if it is 1 to many you need to form script matrix to define what happens on each change.
    It depends on the details but thats the core of it.

  • How can you tell how fast you are sampling when using digital inputs to the PCI6014

    i am currently sampling information via th edigital inputs of teh PCI6014. However in order to perform FFT and even to use the "Amplitude and Phase Spectrum vi" i need to know my sampling rate so that i can wire this constant to dt.i have attached the Vi that i created as well as some sample data. can you please help me to configure it such that i obtain a correct display of amplitude and phase. thanks
    Attachments:
    DISPLAY3 ‏40 KB
    proper_sampling_at_1Hz.txt ‏1 KB

    Hello,
    Thanks for contacting National Instruments.
    I found some information that I feel will help you to calculate the sampling rate, so that you'll be able to use this constant in your VI. Please see the link below.
    http://digital.ni.com/public.nsf/websearch/5782F1B396474BAF86256A1D00572D6E?OpenDocument
    I hope this helps you. Please let me know if you need any further support. Have a great day!
    Regards,
    Joe Des Rosier
    Applications Engineering

  • How to get list data to Excel to create chart with date filter?

    Hi all,
    I have to create chart from a custom list in o365 site. There is one column named "Due Date" in my list. I want only those records whose Due Date is today or gone, I mean Due Date <= Today.
    How can do it?
    I have tried following ways.
    I have tried with REST (OData Data Feed) but not able to use Today's date (I mean dynamic) as filter.
    I have tried by Export to Excel my view and it is working but if I am uploading my excel file to o365 and refreshing data connection, it is showing error and not working.
    NOTE : I cannot user Power BI features like Power Query we have not that licences.
    Thanks,
    Ritesh
    Ritesh Goswami

    Hi Ritesh
    Not sure if I understood you correctly but what about creating a calculated field which has an if condition like
    if([Due Date]<=today(), "past", "future"
    and then just filter the 'past' / 'future' column?
    Kind regards,
    https://www.sharepointbay.com

  • How can I restore data from my iPhone after sync with macbook pro?

    I accidentally syncronized my Iphone with MacBook Pro on iTunes and lost all data from my phone (calendar, contacts, photos, etc.). Is there a way to recover that information? Thank you!

    Welcome to Apple Support Communities
    You cannot. However, you can solve this problem by setting the iPhone as a new device and upgrading iOS in Settings -> Software Update.
    After upgrading iOS, open Settings -> General -> Reset -> Erase All Content and Settings. Finally, Setup Assistant will let you restore the backup.

  • How can I label data points in a scatter chart with text strings?

    Post Author: Bill B
    CA Forum: Charts and Graphs
    I need to create a Scatter Chart, with a text label for each data point instead of the xy coordinates. A legend will no longer be necessary.Also, I want to draw "cross-hair" lines on both the x and y axes centered on one particular data point.Any ideas?

    Post Author: ebobo
    CA Forum: Charts and Graphs
    Hi
    I have the same problem here, did you find any solutions.
    Here we are ok if the dimension is displayed in the scatter instead of the measurements but the only options i founds was "Show data" and that option displays the values of the xy.
    pls let me know if anybody found any solution for this problem

  • How to get the data in one internal table? with 3 different tables..

    Hi,
      i need to get the all the ff data to put in an internal table. I'm using these data to my ALV. Thanks
       vkorg TYPE a005-vkorg,
       vtweg TYPE a005-vtweg,
       kschl TYPE a005-kschl,
       kondm TYPE mvke-kondm,
       matnr TYPE a005-matnr,
       kdgrp TYPE knvv-kdgrp,
       konda TYPE knvv-konda,
       kunnr TYPE a005-kunnr,
       datab TYPE a005-datab,

    hi,
    try this
    *& Report  ZPROGRAM
    REPORT  ZPROGRAM.
    table declaration.
    tables : zemployee, zdepartment,zproject.
    *type-pools declaration
    type-pools : slis , icon.
    type specification
    types : begin of ty_emp,
            empid type zempid,
            empname type zempname,
            empaddress type zempaddress,
            city type zcity,
            ponumber type zponumber,
            detid type zdeptid,
            end of ty_emp.
    types : begin of ty_dept,
            detid type zdeptid,
            deptname type zdeptname,
            designation type zdesignation,
            projectid type zprojectid,
            end of ty_dept.
    types : begin of ty_project,
            projectid type zprojectid,
            technology type ztechnology,
            clientname type zclientname,
            end of ty_project.
    types : begin of ty_final,
            empid type zempid,
            empname type zempname,
            empaddress type zempaddress,
            city type zcity,
            ponumber type zponumber,
            detid type zdeptid,
            deptname type zdeptname,
            designation type zdesignation,
            projectid type zprojectid,
            technology type ztechnology,
            clientname type zclientname,
           average type p decimals 2,
            end of ty_final.
    table type specification.
    types : tt_emp type standard table of ty_emp,
            tt_dept type standard table of ty_dept,
            tt_project type standard table of ty_project,
            tt_final type standard table of ty_final.
    work area creation.
    data : wa_emp type ty_emp,
           wa_dept type ty_dept,
           wa_project type ty_project,
           wa_final type ty_final.
    internal table declaration
    data : itab_emp type tt_emp,
            itab_dept type tt_dept,
            itab_project type tt_project,
            itab_final type tt_final.
    layout declaration
      data : gd_layout type slis_layout_alv.
    assigning current program name.
      data : gd_repid like sy-repid.
             gd_repid = sy-repid.
    fieldcatalog declaration.
      data : d_fieldcat type slis_t_fieldcat_alv,
             d_fieldcat_wa type slis_fieldcat_alv.
    header declaration.
      data : t_header type slis_t_listheader,
             wa_header type slis_listheader,
             linecount(10) type c,
             line(10) type c.
    selection-screen.
    selection-screen : begin of block blk1 with frame title text-001.
    select-options : s_empid for zemployee-empid.
    parameters : p_dname like zdepartment-deptname.
    parameters : p_proid like zproject-projectid.
    selection-screen : begin of line.
    parameters : p_rad1 radiobutton group r1.
    selection-screen comment 3(10) text-002.
    parameters : p_rad2 radiobutton group r1.
    selection-screen comment 16(10) text-003.
    selection-screen : end of line.
    parameters : chk1 as checkbox.
    selection-screen : end of block blk1.
    end of selection screen.
    start of selection.
    select empid empname empaddress city ponumber detid from zemployee into corresponding fields of table itab_emp where empid in s_empid.
    if not itab_emp is initial.
    select detid deptname designation projectid from zdepartment into corresponding fields of table itab_dept for all entries in itab_emp where detid = itab_emp-detid .
    if not itab_dept is initial.
    select projectid technology clientname from zproject into corresponding fields of table itab_project for all entries in itab_dept where projectid = itab_dept-projectid.
    endif.
    endif.
    *end of selection.
    populating data into itab_final from itab_emp.
    loop at itab_emp into wa_emp.
    wa_final-empid = wa_emp-empid.
    wa_final-empname = wa_emp-empname.
    wa_final-empaddress = wa_emp-empaddress.
    wa_final-ponumber = wa_emp-ponumber.
    wa_final-city = wa_emp-city.
    wa_final-detid = wa_emp-detid.
    append wa_final to itab_final.
    clear wa_final.
    endloop.
    *populating data into itab_final from itab_dept and itab_project
    loop at itab_final into wa_final.
    read table itab_dept into wa_dept with key detid = wa_final-detid.
    if sy-subrc = 0.
    wa_final-deptname = wa_dept-deptname.
    wa_final-designation = wa_dept-designation.
    wa_final-projectid = wa_dept-projectid.
    modify itab_final from wa_final transporting deptname designation projectid .
    endif.
    read table itab_project into wa_project with key projectid = wa_final-projectid.
    if sy-subrc = 0.
    wa_final-technology = wa_project-technology.
    wa_final-clientname = wa_project-clientname.
    modify itab_final from wa_final transporting technology clientname.
    endif.
    endloop.
    if p_rad1 = 'X' or chk1 = 'X'.
    d_fieldcat_wa-fieldname = 'EMPID'.
    d_fieldcat_wa-seltext_l = 'Employee Id'.
    d_fieldcat_wa-emphasize = 'X'.
    d_fieldcat_wa-col_pos = 1.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'EMPNAME'.
    d_fieldcat_wa-seltext_l = 'Employee Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 2.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'EMPADDRESS'.
    d_fieldcat_wa-seltext_l = 'Employee Address'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 3.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'CITY'.
    d_fieldcat_wa-seltext_l = 'City'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 4.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'PONUMBER'.
    d_fieldcat_wa-seltext_l = 'Postal Number'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 5.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DETID'.
    d_fieldcat_wa-seltext_l = 'Department Id'.
    d_fieldcat_wa-emphasize = 'X'.
    d_fieldcat_wa-col_pos = 6.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DEPTNAME'.
    d_fieldcat_wa-seltext_l = 'Department Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 7.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DESIGNATION'.
    d_fieldcat_wa-seltext_l = 'Designation'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 8.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'PROJECTID'.
    d_fieldcat_wa-seltext_l = 'Project Id'.
    d_fieldcat_wa-emphasize = 'X'.
    d_fieldcat_wa-col_pos = 9.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'TECHNOLOGY'.
    d_fieldcat_wa-seltext_l = 'technology'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 10.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'CLIENTNAME'.
    d_fieldcat_wa-seltext_l = 'Client Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 11.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    endif.
    if p_rad2 = 'X' or chk1 = 'X'.
    refresh itab_emp.
    d_fieldcat_wa-fieldname = 'DETID'.
    d_fieldcat_wa-seltext_l = 'Department Id'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 6.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DEPTNAME'.
    d_fieldcat_wa-seltext_l = 'Department Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 7.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DESIGNATION'.
    d_fieldcat_wa-seltext_l = 'Designation'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 8.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'PROJECTID'.
    d_fieldcat_wa-seltext_l = 'Project Id'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 9.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'TECHNOLOGY'.
    d_fieldcat_wa-seltext_l = 'technology'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 10.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'CLIENTNAME'.
    d_fieldcat_wa-seltext_l = 'Client Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 11.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    endif.
    Grid display function module
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
       I_INTERFACE_CHECK                 = ' '
       I_BYPASSING_BUFFER                = ' '
       I_BUFFER_ACTIVE                   = ' '
        I_CALLBACK_PROGRAM                = gd_repid
        I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
       I_CALLBACK_USER_COMMAND           = ' '
        I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE '
       I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
       I_CALLBACK_HTML_END_OF_LIST       = ' '
       I_STRUCTURE_NAME                  =
       I_BACKGROUND_ID                   = ' '
        I_GRID_TITLE                      = 'EMPLOYEE DETAILS'
       I_GRID_SETTINGS                   =
        IS_LAYOUT                         = gd_layout
        IT_FIELDCAT                       = d_fieldcat
       IT_EXCLUDING                      =
       IT_SPECIAL_GROUPS                 =
       IT_SORT                           =
       IT_FILTER                         =
       IS_SEL_HIDE                       =
       I_DEFAULT                         = 'X'
       I_SAVE                            = ' '
       IS_VARIANT                        =
       IT_EVENTS                         =
       IT_EVENT_EXIT                     =
       IS_PRINT                          =
       IS_REPREP_ID                      =
       I_SCREEN_START_COLUMN             = 0
       I_SCREEN_START_LINE               = 0
       I_SCREEN_END_COLUMN               = 0
       I_SCREEN_END_LINE                 = 0
       I_HTML_HEIGHT_TOP                 = 0
       I_HTML_HEIGHT_END                 = 0
       IT_ALV_GRAPHICS                   =
       IT_HYPERLINK                      =
       IT_ADD_FIELDCAT                   =
       IT_EXCEPT_QINFO                   =
       IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER           =
       ES_EXIT_CAUSED_BY_USER            =
       TABLES
         T_OUTTAB                          = itab_final
      EXCEPTIONS
        PROGRAM_ERROR                     = 1
        OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    set pf_status for creating client specified icons.
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status 'NEWSTATUS'.
    endform.
    populating data into header using top_of_page
    form top_of_page.
    wa_header-typ = 'H'.
    wa_header-info = 'ALV REPORT'.
    append wa_header to t_header.
    clear wa_header.
    wa_header-typ = 'S'.
    wa_header-key = 'Date :'.
    Concatenate sy-datum+6(2) '.'
                 sy-datum+4(2) '.'
                 sy-datum(4) into wa_header-info.
      append wa_header to t_header.
      clear wa_header.
      wa_header-typ = 'S'.
    wa_header-key = 'Time :'.
    Concatenate sy-Uzeit(2) '.'
                 sy-datum+2(2) '.'
                 sy-datum+4(2) into wa_header-info.
      append wa_header to t_header.
      clear wa_header.
      describe table itab_final lines line.
      wa_header-typ = 'A'.
      linecount = line.
      Concatenate 'Total number of records :' linecount into wa_header-info separated by space.
      append wa_header to t_header.
      clear wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = t_header
         I_LOGO                   = 'VMCADMIN'
        I_END_OF_LIST_GRID       =
        I_ALV_FORM               =
      endform.
    *designing layout.
      form gd_layout.
      gd_layout-zebra = 'X'.
      gd_layout-edit = 'X'.
      gd_layout-no_hotspot = ''.
      gd_layout-no_colhead = ''.
      gd_layout-colwidth_optimize = 'X'.
      endform.
    Reward with points if helpful.

  • How can i load data from access database to datagridview with custom columns all days of a month ?

    Hi guys
    I am newbie in vb net and I want your help to solve a problem.
    I have this datagridview with two columns and all days of a month in custom columns.
    [IMG]http://i59.tinypic.com/2qwpj15.png[/IMG]
    I also have one combobox to change Year and a combobox to change Month.
    Here is the code to load data
    Private Sub fill_plan()
    dgMonth.Rows.Clear()
    Try
    Dim i As Integer = 0
    Dim query As String = "SELECT MonID,Unitname,Personel,Udate FROM tblMonth ORDER BY Unitname"
    con.Open()
    cmd = New OleDbCommand(query, con)
    myDR = cmd.ExecuteReader
    If myDR.HasRows Then
    While myDR.Read
    dgMonth.Rows.Add()
    dgMonth.Rows(i).Cells(0).Value = myDR.GetInt32(myDR.GetOrdinal("MonID"))
    dgMonth.Rows(i).Cells(1).Value = myDR.GetString(myDR.GetOrdinal("Unitname"))
    dgMonth.Rows(i).Cells(2).Value = myDR.GetInt32(myDR.GetOrdinal("Personel"))
    i = i + 1
    End While
    End If
    myDR.Close() : con.Close()
    Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
    End Try
    End Sub
    With
    this code the
    personel column
    loads the first
    day of the month.
    I want to load
    the column the date that is
    in the database.

    Hello,
    This can be done with less code
    Private Sub fill_plan()
    dgMonth.DataSource = Nothing
    Dim dt As New DataTable
    Try
    Dim query As String = "SELECT MonID,Unitname,Personel,Udate FROM tblMonth ORDER BY Unitname"
    con.Open()
    cmd = New OleDbCommand(query, con)
    dt.Load(cmd.ExecuteReader)
    dgMonth.DataSource = dt
    Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
    End Try
    End Sub
    The above loads all rows, if you want to limit the rows placed in the DataGridView this is best done in the SQL via WHERE conditions and/or with SELECT TOP x.
    Formatting of the data is best done via the property window for the DataGridView on whatever column you want too. Using the above you now need to set the data property for each column and set dgMonth.AutoGenerateColumns = False, in the end we end up with
    less code
    edit is there a reason for returning the primary key? If so then using my method we can hide that field but I see no reason for having it in this case
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

Maybe you are looking for