Construindo vetores

Boa noite colegas. 
Meu problema é o seguinte: 
Objetivo: Contruir um subVI que faça média móvel de "n" elementos de um vetor que faz sucessivas leituras.
Meu algoritmo mental:
1º) Inicializar o vetor: valor de INICIALIZAÇÃO e "n" ELEMENTOS;
2º) Quero adicionar na posição "i", do vetor inicializado, o NEW ELEMENT;
3º) O time Delay tah ali pro While não "disparar";
4º) Gostaria de colocar no FrontPanel a atualiização, em tempo real, das posições.
Esse é um problema prático em que gostaria de aprender os fundamentos da manipulação de vetores/matrizes, com boas práticas de LV.
Não consigo compreender por que o parâmetro "INDEX 0", da função "INSERT INTO ARRAY", não é atualizado junto com o indicador de contagem do While, de forma que, no FrontPanel, as amostras estejam em ordem decrescente, ou seja, a mais recente leitura está no topo. (ou embaixo. O que preciso é do vetor das últimas "n" amostras para conseguir viabilizar a média móvel. A questão estética do FrontPanel é secundária). 
Obrigado pela cooperação,
[]'s,
Renato.
PS.: Já achei, no Grande G, informações sobre Shift Register, mas, como comentei com  vocês, gostaria de manipular vetores e matrizes
Solucionado!
Ir para Solução.
Anexos:
vetor_01.vi ‏21 KB

Olá Renato,
Desculpe renato, acho que eu não fui muito claro, a sua lógica de manipulação dos arrays funciona, você só precisa utilizar um shift register para realimentar o vetor de saída com os novos valores, quando você não utiliza um shift register é como se a cada iteração do loop você tivesse um novo vetor completamente diferente.
Anexei um VI que provavelmente não é a melhor solução mas com ele acredito que você compreenderá melhor o que quero dizer.
O Insert into array não é a melhor solução porque ele faz uma alocação dinâmica de memória, ou seja a cada elemento não inicializado que você inserir ele vai fazer uma nova alocação de memória para o vetor. A melhor opção seria um vetor com tamanho fixo e utilizar a função Replace Array Subset, de modo que você substitui os valores de um vetor utilizando um mesmo espaço de memória, não sendo secessária a realocação.
Quanto a questão do loop em um subVI, em LabVIEW utilizamos uma técnica chamada FGV - Functional Global Variable. Entre as várias funções de uma FGV podemos utilizá-la para isso. Seguem alguns links sobre FGV.
https://decibel.ni.com/content/docs/DOC-2143
http://labviewjournal.com/2011/08/race-conditions-and-functional-global-variables-in-labview/
https://decibel.ni.com/content/docs/DOC-20897
Você também pode encontrar informações sobre FGV no help do LabVIEW.
Fica também uma dica para todos os usuários do fórum, sempre mencionem qual a versão de LabVIEW, ou qualquer outro software, que você está utilizando já que a versão anterior não abre um arquivo da versão mais recente.
Para você e todos aqueles que estão iniciando em LabVIEW deixo também um link um conteúdo introdutório ao LabVIEW que se chama Aprenda LabVIEW em 6 horas. Todo este material está em português.
http://www.ni.com/white-paper/12689/pt
Além disso a NI oferece vários cursos aqui no Brasil e a agenda dos cursos pode ser conferida no site.
http://brasil.ni.com/treinamentos/calendario
A equipe de marketing da NI também promovem e participam de diversos eventos, em alguns eles provemem sessões práticas na utilização das ferramentas NI.
Bom carnaval!
Atenciosamente,
Abel Souza
Engenheiro de Aplicações
National Instruments Brasil
Anexos:
exemplo_array.vi ‏7 KB

Similar Messages

  • Projeto - Reconhecimento de Voz e Comunicação Serial

    Olá, estou desenvolvendo um projeto no qual devo reconhecer comandos de voz e enviar posteriormente informações através de comunicação serial.
    A idéia do projeto é a seguinte :
    - Reconhecer comandos de voz como "POSIÇÃO 1, POSIÇÃO 2"
    - Para cada comando reconhecido, uma mensagem deve ser enviada via comunicação serial.
    No entanto, não venho conseguindo reconhecer comandos de voz através de alguns VI's fornecidos pela NI, então venho pedir ajuda para procurar um caminho para começar a construir tal projeto.
    Grato desde já.
    Gilberto Neto
    Estudante de Tecnologia em Mecatrônica Industrial
    Faculdade de Tecnologia Termomecanica

    Olá, achei bem interessante este projeto, porém tenho algumas perguntas:
    Existe alguma especificação quanto ao Hardware para capturar o sinal?
    Quando você diz: "Reconhecer comandos de voz como "POSIÇÃO 1, POSIÇÃO 2", você está se referindo que o conteúdo da mensagem falada é "POSIÇÃO 1,POSIÇÃO 2" ou que isso é uma mera identificação para uma mensagem diferente?
    Capturar o sinal emitido pela voz é relativamente fácil,porém a identificação e interpretação desse sinal que é algo mais complexo (Relativo a segunda pergunta que eu fiz). Com as VI's da paleta (Sound), você irá apenas coletar esse sinal, porém a análise heurística para interpretação fica a cabo do desenvolvedor. Felizmente, existem algumas Library como o SAPI e outras para abreviar este processo.
    Sobre a serialização deste sinal, você será basicamente "obrigado" a trabalhar com filas de tamanho fixo , pois os dados devem ser armazenados em sequência e serem despachados em blocos ANTES de serem repassados as funções VISA. Uma dica é repassar essa informação utilizando dados do tipo Digital (0,1) em vetores bidimensionais para assegurar que a mensagem seja serializada completamente (sem perder nenhum bit pelo caminho)
    Você irá precisar de 3 Loops: Um para a captura dos dados, um para interpretação e arranjo e outro para envio das informações. Pesquise sobre a arquitetura QMH ou P/C. Não é necessário usar nada mais complexo neste quesito
    Espero que eu tenha ajudado
    "In theory, theory and practice are the same. In practice, they’re not."

  • Muse has a lot to improve

    Only very basic projects.
    The needy tools Muse to be used on larger projects.
    Confused css classes;
    Does not support CSS sprites natively;
    Does not use oocss;
    Produces separate style sheets for each page;
    Does not allow freedom in the organization of css and javascript documents;
    A change to a page generates upload several other;
    Desktop's muse and bad;
    The muse has shortcut to zoom?
    Does not support properly vectors;
    Creates images when using internal shadows on divs;
    Does not optimize the pages with php, separating the site in header.php parts, menu.php, footer.php among others. With php use would be entirely possible to change a menu on the master page without having to upload all page again;
    Not compact html, css and javascript;
    Does not allow cache configuration in .htaccess;
    Do not load Java script asynchronously;
    Style classes in muse and weak and with few options;
    Has no semantic structure of html5;
    Slide horrible buggy and very basic functions;
    Acordion and tabs not big work with fade transition;
    Jpg image compression and very weak png;
    Does not convert fonts for @ font-face;
    Very weak form without obvious functions necessary for better interaction with the end user;
    Seo bad, lack a native seo test tool in muse.
    The muse creates different layouts for each device, this way of working and not the reality of the current Internet, today we need to make fluid layouts can not get locked into pixes because every new day and new devices with size and resolution are launched web and infinite in your document display size is not equal to a role with specific measures and margins for each document.
    Please adobe developers to use:
    PageSpeed google to improve the muse build system.
    Original message in PT_BR
    O Muse carente de ferramentas para ser usado em projetos maiores.
    Classes css confusas;
    Não suporta sprites css nativamente;
    Não utiliza o oocss;
    Produz folhas de estilos separadas para cada página;
    Não permite liberdade na organização dos documentos css e javascript;
    Uma alteração em uma página gera upload de várias outras;
    Área de trabalho do muse e ruim;
    O muse tem atalho para zoom ?
    Não suporta corretamente vetores;
    Cria imagens quando usamos sombras internas nas divs;
    Não otimiza as páginas com php, separando o site em partes header.php, menu.php, footer.php entre outros. Com uso do php seria totalmente possível alterar um menu na página mestra sem ter que fazer upload de todas as página novamente;
    Não compacta html, css e javascript;
    Não permite configuração de cache no .htaccess;
    Não carrega Java script de maneira ***íncrona;
    Classes de estilo no muse e fraca e com poucas opções;
    Não tem estrutura semântica de html5;
    Slide horrível cheio de bugs e com funções muito básicas;
    Acordion e tabs não trabalhão com transição fade;
    Compressão de imagens jpg e png muito fraco;
    Não converte fontes para @font-face;
    Formulário muito fraco sem funções obvias necessárias para melhor interação com o usuário final;
    Seo ruim, falta uma ferramenta de teste de seo nativa no muse;
    O muse cria layouts diferentes para cada dispositivo, esse jeito de trabalhar não e a realidade da internet atual, hoje precisamos fazer layouts fluidos não podemos ficar presos a pixes pois a cada dia novos e novos dispositivos com tamanho e resolução são lançados a web e infinita no seu tamanho de apresentação de documentos não e igual a um papel com medidas e margens específicas para cada documento.
    Por favor desenvolvedores da adobe usem:
    Pagespeed do google para melhorar o sistema de compilação do muse.

    Please feel to add your suggestion in our ideas section.
    Thanks,
    Sanjit

  • Validação de campos em um Table Control

    Boa tarde.
    Gostaria de pedir um auxilio .
    Tenho uma duvida, na seguinte situação. Estou construindo um programa de Module Pool
    Neste programa vai ter um tabstrip, para atualizar duas tabelas Z
    Na primeira u201CABAu201D, serão  inseridos os registros da tabela pai e na segunda u201CABAu201D, os registros da tabela
    Filho a relação será de 1 para N.
    Na tabela filho os campos  chaves serão um identificador próprio , mais o registro chave da tabela pai.
    Na segunda a aba para inserir os registros da tabela filho, terei que usar um table Control.
    O meu problema é que ao inserir os registros na tabela filho, terei que de forma automática preencher o campo que corresponde a chave da tabela pai. Ou seja o usuário na primeira u201Cabau201D digamos digite o código da tabela pai como 10 ao inserir na table Control um registro o campo correspondente a chave  da tabela pai devera ser preenchido com o valor 10 e não permitir ao usuário efetuar qualquer manutenção neste campo.
    Como eu faço isso???
    Alguém tem algum exemplo????
    Obrigado a todos

    Olá, bom dia!
    Este é um dessenvolvimento bem específico, talvez por isso ninguem lhe respondeu ainda. Voce já deu uma olhada na seção de Wiki, buscando algum código de exemplo?
    Vai alguns links que encontrei:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1499ec90-0201-0010-769f-860989655f7e?QuickLink=index&overridelayout=true
    http://wiki.sdn.sap.com/wiki/display/sandbox/ModulePoolProgramming
    O primeiro link traz um exemplo de como torna um campo ineditavel via codigo. Espero que possa ajudar.
    Abraços,
    Rodrigo Paisante

  • How to add a VO in vector ,Using Vectors and VO

    Actully I have to add a Patch in a working live application it is somthing like this:
    it having an VO as
    ProductVO product_vo=new ProductVO();
    this Product VO having all produt i.e. item code here entries.
    Vector vectMasterProductName=new Vector();
    String product=null;
    double sumTotal = 0;
    vectMasterProductName=order_dao.getMasterProductNames();// This vectot contains all the products inthe database
    now the old code was :
    for (Iterator iterator = vectProduct_vo.iterator(); iterator.hasNext();){
         product_vo=(ProductVO)iterator.next();
         sumTotal=sumTotal+product_vo.getLineTotal();
         product = product_vo.getItemCode();
         }//end for
         //System.out.println("Sumtotal:"+sumTotal);
    but this was not handling the case when product_vo is populated with the same itemCode more then one time, now we have to add all the quantities together for the same tpe of peoduct.
    when I do this as following:
    int count=0;double itemNumber = 0;
         for (int i=0;i<vectProduct_vo.size();i++){
              product_vo=(ProductVO)vectProduct_vo.elementAt(i);
    if(vectProduct_vo != null){ 
         itemNumber =product_vo.getQuantity();
         sumTotal=sumTotal+product_vo.getLineTotal();
    for(int j=i+1;j<vectProduct_vo.size();j++){
         product_vo1=(ProductVO)vectProduct_vo.elementAt(j);
    if(product_vo != null && product_vo.getItemCode().equals(product_vo1.getItemCode())){
         itemNumber=itemNumber+product_vo1.getQuantity();
         vectProduct_vo.set(j,null);
    vectProduct_vo.removeElement(null);
    System.out.println("Itemcode and Quanity "+product_vo.getItemCode()+": " + itemNumber );
    count++;
         order_dao.insertProducts(orderID,vectProduct_vo);
    It is working fine for the first item in the vector but after that the vector having no values i.e. I am getting nll pointer exception.I need all the values in the vector but in the same manner as I discussed before that same type of item marg together with the quantity.
    Please guide me for the same.
    Many thanks It is very very urgent now.

    yes you are corrct that it is an old approach but my roject required it.
    the vector is properly getting values but when I am using the vector.removeElementAt(j) whole vetor is gettiing null value .. after this I am getting null pointer exception. actully this poduct_VO is populaed through XML comming from other system.
    ProductVO extends BaseVO{
         private String itemCode;//same as ProductName
         private double quantity;
         private double itemUnitPrice;
         private String itemDescription;
         private double lineTotal;
         private String itemPremiumDiscount;
         private double itemPremiumDiscountAmount;
         private String productIndicator;
    and some getter setter methods.
    and the code is same as i discussed first.
    what I was trying to change the code for multiple values as
    for (int i=0;i<vectProduct_vo.size();i++)
    product_vo=(ProductVO)vectProduct_vo.elementAt(i);
    if(vectProduct_vo != null)
    itemNumber =product_vo.getQuantity();
    sumTotal=sumTotal+product_vo.getLineTotal();
    for(int j=i+1;j<vectProduct_vo.size();j++){
    product_vo1=(ProductVO)vectProduct_vo.elementAt(j);
    if(product_vo != null && product_vo.getItemCode().equals(product_vo1.getItemCode()))
    {                                             itemNumber=itemNumber+product_vo1.getQuantity();
    vectProduct_vo.set(j,null);
    vectProduct_vo.removeElement(null);
    System.out.println("Itemcode and Quanity "+product_vo.getItemCode()+": " + itemNumber );
    count++;
    and if I am using removeElementAt(j) the outpou is totally diffrent.
    The above code is working fine while i am working in a local environment but fales in the project.
    Vector is not populted after one element population.
    please help me out, I m not getting the exact way.
         order_dao.insertProducts(orderID,vectProduct_vo);

  • How can I save file as other format?

    I want to create file and save file as others Vetor format,such as Dwg,dxf,ai and i can open it in AutoCad as well as Illustrator.How can i do it ??
    Thanks in advance!
    E-Mail:[email protected]

    every file format has its own format, I mean by format is really "format".
    any characteristic has its own specific place in a special format.
    you can make your own file format, so you will keep your information in a special part of file and so and so.
    And when you want to retrieve your informtion you know where and how you are able to do it.
    Now if you want to use somebody else's format like "DXF" you need to somehow find out what is the format of that particular file, so if you through your application have provided the same type of information and save them in the same manner, your file will become the same format that you wanted to be.
    I invite you take a look at the following address on web:
    http://thorkildsen.no/faqsys/cates/formats.html
    good luck,
    Nader.

  • Saving/Printing work from within a .swf file

    Okay so here's the deal. I have to create a flash game in
    which users will be creating artwork. When users are done with
    their artwork we want them to be able to SAVE their work, EMAIL it
    to a friend, and PRINT it out all within the .swf file.
    HOW IN THE WORLD DO YOU DO THIS?????? I have been searching a
    researching and going through many forums and tutorials trying to
    see if anyone out there can help but I have come up with nothing.
    Although I did come a across a website that was able to achieve
    what we are looking to do in this flash game.
    Click here to view
    Snowflake Website
    On this website users can make snowflake art the old fashion
    way but this time on the web within a flash site. When users are
    satisfied with their snowflake they can save it and the snowflake
    is added to an ever growing database of user created snowflakes
    that also can be viewed by others at anytime. Users are also given
    the option of emailing their snowflake design to friends and
    downloading their design as a JPEG or and EPS file. You can also do
    the same to any of other numerous snowflake designs with the
    snowflake design database.
    HOW IN THE WORLD DO YOU DO THIS??? I have contacted the
    agency that was responsible for creating this site for their help
    as well but any assistance I can get from you guys would be greatly
    appreciated as well.
    Still quite confused but eagerly awaiting your
    responses.

    Printing object:
    on (release) {
    //creates the object of the class printjob
    var pj:PrintJob = new PrintJob();
    //starts the procedure
    //opens the windows printing window
    pj.start();
    //sets the printing area (i may be made outside the stage,
    so using the A4 area and adding any other information that should
    not appear on screen)
    area = {xMin:0, yMin:28, xMax:465, yMax:296};
    //printing options - true=bitmap / false-=vetor... bitmap
    generates a bigger file, but results in better quality for images,
    vector is smaller and a good option if you work just with text
    options = {printAsBitmap:true};
    //adds the page the the printing queue
    pj.addPage(_root, area, options, null);
    //sends the page to the printer
    pj.send();
    //deletes the object to clear memory (very important)
    delete pj;

  • How can I store a File object into a Vector and get it back

    hi there
    I need to store a number of File object into a Vector first, and later on I need to get each File object out and work with it.
    Vector mylist;
    File[] myfile;
    ....get a list of files from using File Chooser
    mylist = new Vetor();
    for (i=0;i<myfile.length;i++){
    mylist.add(myfile);
    ..how do I get them back? i try to do this way
    for (i=0;i<mylist.size(); i++)
    File tempfile = mylist.get(i);
    ..work with tempfile. but I got java.lang.object error: imcompatible types. what can I do?

    Vector mylist;
    File[] myfile;
    ....get a list of files from using File Chooser
    mylist = new Vetor();
    for (i=0;i<myfile.length;i++){
    mylist.add(myfile);
    ok try this: i don't reall understand what your trying to do though...
    File[] files;
    // get files
    Vector fileList = new Vector();
    for (int i = 0; i < files.length; i++)
      fileList.add(files);
    // to get them out.
    for (int i = 0; i < fileList.size(); i++)
    ((File)fileList.elementAt(i)).toString();
    // or
    // to get them out.
    for (int i = 0; i < fileList.size(); i++)
    File temp = (File)fileList.elementAt(i);
    System.out.println(temp.toString);

  • Centro battery runs down quickly

    My battery doesn't seem to last very good. I start the day with a fresh charge and make or receive maybe two short calls in a day and use the cal or contacts a couple times and by evening my battery is dead to the point my phone shuts off or very low on on charge. I'd hate to see what happened if I used the web much. Is this normal? I thought with that much stand by I'd have plenty of battery each day. Thank you.
    Jim Vetor
    Post relates to: Centro (Sprint)
    Message Edited by smkranz on 05-24-2008 07:30 AM

    Hi,
    I am sorry to disagree, but on Sprint's Palm Centro, once you are done using the web, it does indeed stop the connection. Hence the fact that when you click on the WEB Icon, it takes a few seconds to reconnect to either the last page viewed or the original sprint home page. I have the centro from sprint since it came out OCT 14th. I have had the same batt, however I do keep a spare one on hand and a car charger if needed.  I am a heavy user on my device, I average about 3,000 min a month, I use the web for anything from CNN, to myspace, ticket master, check my personal banking, look up tickermaster, nba.com, the list goes on and everytime I use another application and go back to the web, it takes a few seconds to reconnect b/c it's not always connected. I also use my email routed through work.
    Unfortunately , palm as made a slim batt. To be used with a slim device like so. My batt will be drained by the evening time, around 6 or 7 eastern time with about 18% of batt life.
    I'll even play games bought from sprint, from 30mins to an hour and more and still using the same batt.
    If you take ur phone to a sprint store and are with in 30 days, they will exchange it, anything over 30 days they will suggest having a tech look at ur device and most likely explain the same things I am.
    Now, there are some settings that can help "conserve" batt life. And if you go into the power option under preferences, it will have a little bubble that says tips in the rt hand corner. That will tell you a few things on how to save batt life. You can also change the power settings for the back light and also make sure the blue tooth is turned off. You can also check your roaming settings, to be at home only, not allow roaming.
    Hope that helps, but most users have poor batt life by the end of the day, this phone is made to use many applications which can drain the batt. life
    Post relates to: Centro (Sprint)

  • Implementing a table

    I need to have a static data structure inside my aplication. So, I'm trying to implement a class that simulates the behaviour of a table, with all its methods, like 'addRow', 'delRow'. A structure a little like a Recordset object in other languages, but not connected to any database, only the structure with methods and properties. I really believe that someone in the world has already done that. Does anyone know if it really exists and where i can get it? Thanks a lot.

    I got it. I finally got to have it implemented. In case somebody should need it, here it goes:
         Classe que implementa ResultSet offline
         Esta classe serve como um objeto ResultSet offline. Isso quer dizer que o usu�rio
         poder� instanciar um objeto desta classe, fechar a conex�o com o banco de dados e
         continuar acessando o conte�do do ResultSet fechado com a conex�o.
    Depois de compilado, copiar este arquivo para D:\j2sdk1.4.0\lib\tabela
    package tabela;
    import java.lang.*;
    import java.util.*;
    import java.sql.*;
    public class rstOff {
         //Vari�vel que guarda a quantidade de colunas existentes no ResultSet
         private int numberOfColumns;
         //Vari�vel que guarda o n�mero de linhas existentes no ResultSet
         private int numberOfRows = 0;
         //Vari�vel que guarda a linha ativa do rstOff
         private int POS;
         //Este array de vetor � a tabela onde ficar�o guardados os campos do ResultSet
         private Vector[] vcBase;
         public rstOff(ResultSet rst) {          
    //          int numberOfRows;
              try {
                   //Descobre o n�mero de campos que o ResultSet possui
                   numberOfColumns = getNumOfColumns(rst);
                   System.out.println("N�mero de colunas igual a " + numberOfColumns);
                   //Inicializa a tabela para a qual o ResultSet ser� copiado
                   inicializa();
                   //Faz a c�pia de todos os campos do ResultSet para a tabela inicializada
                   copia(rst);
                   POS = 0;
              } catch(Exception e) {
         public rstOff() {
              numberOfColumns = 4;
              inicializa();
              for(POS=0;POS<2;POS++) {
                   vcBase[0].add(POS, "a" + POS);
                   vcBase[1].add(POS, "b" + POS);
                   vcBase[2].add(POS, "c" + POS);
                   vcBase[3].add(POS, "d" + POS);
              POS=0;
              System.out.println(POS);
         //Inicializa as vari�veis globais
         private void inicializa() {
              //Inicializa a vari�vel que percorre o ResultSet com 0
              POS = 0;
              //Define o tamanho do array de vetores
              vcBase = new Vector[numberOfColumns];
              //Instancia cada um Vector em cada uma das posi��es do array de vetores
              for(int count = 0;count<numberOfColumns;count++) {
                   vcBase[count] = new Vector();
    //               vcBase[count].add("Deu certo");
              System.out.println("Objeto instanciado");
         //Copia todos os campos do ResultSet para a tabela offline
         private void copia(ResultSet rstCopia) throws SQLException {
              //Move o cursor do ResultSet para antes da primeira linha porque
              //ser� utilizado o m�todo next()
              rstCopia.beforeFirst();
              //Percorre todas as linha do ResultSet com o m�todo next()
              while(rstCopia.next()) {
    //               System.out.println("O numero de linhas e " + numberOfRows);
                   numberOfRows++;
                   //Percorre todas as colunas do ResultSet dentro da mesma linha
                   for(int j=0;j<numberOfColumns;j++) {
                        //Faz a c�pia de cada campo na linha para a tabela offline
                        //O m�todo add insere o elemento na �ltima posi��o automaticamente
                        //Como se fosse "vcBase[j].add(ULTIMAPOSICAO, rstCopia.getObject(j));"
    //                    System.out.println(rstCopia.getObject(j+1));
                        vcBase[j].add(rstCopia.getObject(j+1));
              System.out.println("N�mero de linhas igual a " + numberOfRows);
         //Recebe o ResultSet como par�metro e devolve a quantidade de colunas do ResultSet
         private int getNumOfColumns(ResultSet rstNumOfColumns) throws SQLException {
              ResultSetMetaData rsmd = rstNumOfColumns.getMetaData();
              return rsmd.getColumnCount();
         //Recebe a coluna da linha ativa e retorna o valor
         public Object getValue(int column) {
    //          System.out.println(POS);
              return vcBase[column].get(POS);
         public boolean next() {
              if(POS<numberOfRows) {
                   POS++;
                   return true;
              } else {
                   return false;     
         public boolean previous() {
              if(POS>-1) {               
                   POS--;
                   return true;
              } else {
                   return false;     
         public boolean first() {
              POS = 0;
              return true;     
         public boolean last() {
              POS = numberOfRows-1;
              return true;     
         public boolean beforeFirst() {
              POS = -1;
              return true;
         public boolean afterLast() {
              POS = numberOfRows;
              return true;
         public int rowCount() {
              return numberOfRows;
         public int columnCount() {
              return numberOfColumns;
         public int absolutePosition() {
              return POS;
    Any questions, email me: [email protected]
    Thanks for everything.

  • HALT: Object header already written - STMS ERROR 16

    Hi folks!!!
    Please I need a hand I´ve tried export a TR however during the export process I got the error 16.
    This only happens when I try to export TR that content programs.
    Please any support is really appreciated.

    Hi Deepak,
    Offcourse the log file content is bellow.
    1 ETP199X######################################
    1 ETP182 CHECK WRITEABILITY OF BUFFERS
    1 ETP101 transport order     : "DEVK900367"
    1 ETP102 system              : "DEV"
    1 ETP108 tp path             : "tp"
    1 ETP109 version and release : "380.10.20" "720"
    1 ETP198
    4 ETP201 Check target systems buffer: "\sapmnt\trans\buffer\QAS"
    3 ETP203 Buffer "\sapmnt\trans\buffer\QAS" is writeable
    1 ETP182 CHECK WRITEABILITY OF BUFFERS
    1 ETP110 end date and time   : "20140819185544"
    1 ETP111 exit code           : "0"
    1 ETP199 ######################################
    1 ETP199X######################################
    1 ETP183 EXPORT PREPARATION
    1 ETP101 transport order     : "DEVK900367"
    1 ETP102 system              : "DEV"
    1 ETP108 tp path             : "tp"
    1 ETP109 version and release : "380.10.20" "720"
    1 ETP198
    2 EPU230XExecution of the export pre-processing methods for request "DEVK900367"
    4 EPU111    on the application server: ""
    4 EPU138    in client                            : "200"
    2 EPU235XStart: Version creation of the objects of the request "DEVK900367"
    3 EPU237 Version creation started as update request
    2 EPU236 End: Version creation of the objects of the request "DEVK900367"
    2 EPU231XStart: Adjusting the object directory for the objects of the request "DEVK900367"
    2 EPU232 End:  Adapting the object directory for the objects of the request "DEVK900367"
    2 ETN085 "Acrescentar vetor de componente" " " " " " "
    2 ETN085 "Encerrado" " " " " " "
    1 ETP183 EXPORT PREPARATION
    1 ETP110 end date and time   : "20140819185550"
    1 ETP111 exit code           : "0"
    1 ETP199 ######################################
    1 ETP199X######################################
    1 ETP150 MAIN EXPORT
    1 ETP101 transport order     : "DEVK900367"
    1 ETP102 system              : "DEV"
    1 ETP108 tp path             : "tp"
    1 ETP109 version and release : "380.10.20" "720"
    1 ETP198
    4 ETW000 D:\usr\sap\DEV\SYS\exe\uc\NTAMD64\R3Trans.exe version 6.24 (release 720 - 04.02.14 - 20:14:02 ).
    4 ETW000 unicode enabled version
    4 ETW000 ===============================================
    4 ETW000
    4 ETW000 date&time   : 19.08.2014 - 18:55:55
    4 ETW000 control file: \sapmnt\trans\tmp\DEVKK900367.DEV
    4 ETW000 > #pid 296 on  (APServiceDEV)
    4 ETW000 > export
    4 ETW000 > file='\sapmnt\trans\data\R900367.DEV'
    4 ETW000 > client=200
    4 ETW000 > buffersync=yes
    4 ETW000 > exporttoascii = yes
    4 ETW000 >
    4 ETW000 > use comm 'DEVK900367'
    4 ETW000 R3trans was called as follows: D:\usr\sap\DEV\SYS\exe\uc\NTAMD64\R3Trans.exe -w \sapmnt\trans\tmp\DEVE900367.DEV \sapmnt\trans\tmp\DEVKK900367.DEV
    4 ETW000 Connected to DBMS = MSSQL ---  SERVER = '' DBNAME = 'DEV' --- SYSTEM = 'DEV'.
    4 ETW690 COMMIT "0" "0"
    4 ETW000  trace at level 1 opened for a given file pointer
    4 ETW000
    4 ETW000 ================== STEP 1 =====================
    4 ETW000 date&time        : 19.08.2014 - 18:55:55
    4 ETW000 function         : EXPORT
    4 ETW000 data file        : \sapmnt\trans\data\R900367.DEV
    4 ETW000 buffersync       : YES
    4 ETW000 client           : 200
    4 ETW000 langdeletions    : YES
    4 ETW000 Language    : ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdi(),./:;& (ISO-ARHECSDEENFRELHUITJADAPLZFNLNOPTSKRUESTRFISVBGLTLVZ1SRZHTHKOROSLHRMSUKETAFISCASHIDZ2Z3Z4Z5Z6Z7Z8Z9)
    4 ETW000 Compression      : L
    4 ETW000 commit           : 100000
    4 ETW000 table cache      : dynamic
    3WETW000 exporttoascii    : YES (this means that all non-latin1 characters will be mapped to #, see note 638357)
    4 ETW000
    3 ETW673XUse Commandfile "DEVK900367"
    4 ETW000       /* Homine:Package ZHOM - PROGRAMS */
    4 ETW000       trfunction: 'K' (transport to consolidation system)
    4 ETW000       trstatus  : 'O'
    4 ETW000       tarsystem : QAS      
    4 ETW000       user      : TATIANA
    4 ETW000       date      : 19.08.2014 - 18:55:44
    4 ETW000   1 entry from E070 exported (DEVK900367          ).
    4 ETW000  22 entries from E071 exported (DEVK900367          *).
    4 ETW000   0 entries from E071K exported (DEVK900367          *).
    4 ETW000   1 entry from E070C exported (DEVK900367          ).
    4 ETW000 153 entries from E070A exported (DEVK900367          *).
    4 ETW000   0 entries from CTS_SERIAL exported (DEVK900367          *).
    4 ETW000   1 entry from E07T exported (DEVK900367          *).
    3 ETW678Xstart export of "LIMUREPSZHOM_DELTA_CLIENTE" ...
    4 ETW000 Syslog: k CQC : rscpexcc-getSetting&                                 rscpexcc 12
    4 ETW000 GetDBMigrateCodePagesLangs uses TCP0D, TCPDB, TCP0C.
    4 ETW000   1 entry from TADIR exported (R3TRPROGZHOM_DELTA_CLIENTE                      ).
    4 ETW000   0 entries from SMODILOG exported (PROGZHOM_DELTA_CLIENTE                      REPSZHOM_DELTA_CLIENTE                                                                                                      *).
    4 ETW000   0 entries from SMODISRC exported (CVPROGZHOM_DELTA_CLIENTE                      REPSZHOM_DELTA_CLIENTE                                                                                                      *).
    4 ETW000   0 entries from SMODISRC exported (CUPROGZHOM_DELTA_CLIENTE                      REPSZHOM_DELTA_CLIENTE                                                                                                      *).
    4 ETW000   0 entries from SMODISRC exported (PRPROGZHOM_DELTA_CLIENTE                      REPSZHOM_DELTA_CLIENTE                                                                                                      *).
    4 ETW000   0 entries from SMODISRC exported (SVPROGZHOM_DELTA_CLIENTE                      REPSZHOM_DELTA_CLIENTE                                                                                                      *).
    4 ETW000   0 entries from SMODISRC exported (CIPROGZHOM_DELTA_CLIENTE                      REPSZHOM_DELTA_CLIENTE                                                                                                      *).
    4 ETW000 REPOS ZHOM_DELTA_CLIENTE                       AM exported
    4 ETW000   1 entry from TRDIRT exported (ZHOM_DELTA_CLIENTE                      *).
    4 ETW679 end export of "LIMUREPSZHOM_DELTA_CLIENTE".
    3 ETW678Xstart export of "LIMUREPSZHOM_DELTA_CLIENTE1" ...
    4 ETW000   1 entry from TADIR exported (R3TRPROGZHOM_DELTA_CLIENTE1                     ).
    4 ETW000   0 entries from SMODILOG exported (PROGZHOM_DELTA_CLIENTE1                     REPSZHOM_DELTA_CLIENTE1                                                                                                     *).
    4 ETW000   0 entries from SMODISRC exported (CVPROGZHOM_DELTA_CLIENTE1                     REPSZHOM_DELTA_CLIENTE1                                                                                                     *).
    4 ETW000   0 entries from SMODISRC exported (CUPROGZHOM_DELTA_CLIENTE1                     REPSZHOM_DELTA_CLIENTE1                                                                                                     *).
    4 ETW000   0 entries from SMODISRC exported (PRPROGZHOM_DELTA_CLIENTE1                     REPSZHOM_DELTA_CLIENTE1                                                                                                     *).
    4 ETW000 trace info: table=SMODISRC indx_keyoffset=0 indx_keylen=436 generic_key=342 (SVPROGZHOM_DELTA_CLIENTE1                     REPSZHOM_DELTA_CLIENTE1                                                                                                     PROGZHOM_DELTA_CLIENTE1                     SAPO)
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    4 ETW000 rscpc.c/140/(5706): overlapping buffers at 0000000140769D26 .
    1AETW000 ===> HALT: Object header already written. Please contact the SAP support.
    2 ETP000 protocol: 16, returned: 8, calculated: 16, compared: 8
    4 ETW000 End of Transport (0016).
    4 ETW000 date&time: 19.08.2014 - 18:55:56
    4 ETW000 1 warning occured.
    4 ETW000 1 error occured.
    2EETP200 Export with errors, request will not be imported
    1 ETP150 MAIN EXPORT
    1 ETP110 end date and time   : "20140819185556"
    1 ETP111 exit code           : "16"
    1 ETP199 ######################################
    1 ETP199X######################################
    1 ETP182 CHECK WRITEABILITY OF BUFFERS
    1 ETP101 transport order     : "DEVK900367"
    1 ETP102 system              : "DEV"
    1 ETP108 tp path             : "tp"
    1 ETP109 version and release : "380.10.20" "720"
    1 ETP198
    4 ETP201 Check target systems buffer: "\sapmnt\trans\buffer\QAS"
    3 ETP203 Buffer "\sapmnt\trans\buffer\QAS" is writeable
    1 ETP182 CHECK WRITEABILITY OF BUFFERS
    1 ETP110 end date and time   : "20140820102904"
    1 ETP111 exit code           : "0"

  • PLEASE : How to configure a QueueConnectionFactory

    I need to know how to configure a QueueConnectionFactory in jms.xml. I tried :
         <queue name="Queue proc" location="jms/movProcQueue">
              <description>A dummy queue</description>
         </queue>     
         <queue-connection-factory name="Queue Conn Factory" location="jms/movProcQueueConnectionFactory">
              <description>A dummy topic</description>
         </queue-connection-factory>
    but when i try to get it :
    QueueConnectionFactory conFactory =(QueueConnectionFactory) ctx.lookup("java:comp/env/jms/movProcQueueConnectionFactory");
    I get the following message:
    javax.naming.NameNotFoundException: jms/movProcQueueConnectionFactory not found in Application Client
    java.lang.Object com.evermind.naming.MapContext.lookup(java.lang.String) MapContext.java:49
    Please, I really need to know...

    Hi Marcelo,
    Obviously I can't speak for any one else on this forum -- but I'm not
    a mind reader. The lookup string you use depends on whether your queue
    client is also deployed to the OC4J container or not -- which you fail
    to mention (in fact you don't mention anything about your environment,
    this always helps -- me, at least :-)it's in the same machine (client and OC4J)
    Also, the type of InitialContext object you create also depends on your client type and how you deploy it.it'd the com.evermind.server.ApplicationClientInitialContextFactory
    So perhaps it would help you obtain an answer if you supplied the following:
    1. Platform (SUN, intel, etc.)Intel
    2. Operating system (UNIX, WinNT, linux, etc.)WinNT
    3. OC4J version (1.0.2.2.1?)R2
    4. Your JMS provider (OC4J, Swift, etc.)OC4J
    5. Your deployment descriptors (XML files).I really need to reference the QueueConnectionFactory and the QUeue itself int he application-client.xml file?
    mine:
    <?xml version="1.0"?>
    <!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN" "http://java.sun.com/j2ee/dtds/application-client_1_2.dtd">
    <application-client>
         <resource-ref>
              <res-ref-name>jdbc/OracleDS</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
         </resource-ref>
         <resource-ref>
              <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
              <res-type>jms.javax.jms.QueueConnectionFactory</res-type>
              <res-auth>Container</res-auth>
              <resource-env-ref-type>jms.javax.jms.Queue</resource-env-ref-type>     
         </resource-ref>     
         <resource-env-ref>
              <resource-env-ref-name>jms/Queue</resource-env-ref-name>
              <resource-env-ref-type>jms.javax.jms.Queue</resource-env-ref-type>
         </resource-env-ref>
    </application-client>
    6. Code showing how you are creating your "Context" object.InitialContext ctx=new InitialContext();
    // Lookup a JMS connection factory
    QueueConnectionFactory conFactory =(QueueConnectionFactory) ctx.lookup("java:comp/env/jms/QueueConnectionFactory");
    // Create a JMS connection
    QueueConnection connection = conFactory.createQueueConnection();
    // Create a JMS session object
    QueueSession session = connection.createQueueSession(true,0);
    // Lookup a JMS queue
    Queue queue= (Queue) ctx.lookup("java:comp/env/jms/Queue");
    // Create a JMS sender
    QueueSender sender = session.createSender(queue);
    Enumeration enum=vetor.elements();
    ObjectMessage message=null;
    while(enum.hasMoreElements())
    Movimento mov=(Movimento) enum.nextElement();
    message=session.createObjectMessage(mov);
    sender.send(message);
    //enviar mensagem de fim de processamento
    connection.close();
    Cheers,
    Avi.

  • How open files respectively in a directory ?

    HELLO
    I got this code from this forum to open files and run a macro then close them in a directory . But this code doesn`t execute as I need. I want open files and run macro and close themو respectively . ٍٍEven I numbered files in a sequece but it doesn`t work.
    Can anyone help in this issue !? 
    Sub ProcessFolder()
    ' Path of the workbooks; must end in \
    Const strFolder = "F:\NEW DATA with 4 sheets - Copy\"
    Dim strFile As String
    Dim wbk As Workbook
    ' Don't update the screen for efficiency
    Application.ScreenUpdating = False
    ' Get first filename
    strFile = Dir(strFolder & "*.xls*")
    ' Loop through the files
    Do While strFile <> ""
    ' Open the workbook
    Set wbk = Workbooks.Open(strFolder & strFile)
    ' Do something with the workbook
    Call Macro1
    ' Close the workbook - use False if you don't want to save it
    wbk.Close SaveChanges:=False
    ' Get the next filename
    strFile = Dir
    Loop
    ' Update the screen again
    Application.ScreenUpdating = True
    End Sub
    THANKs
    ABBAS

    'Don't forget to end the path With the \ character:
    Private Const csFolder = "C:\Temp\1\"
    'Private Const sFolder = "F:\NEW DATA with 4 sheets - Copy\"
    Private Sub pProcessFolder()
    Dim sDir As String
    Dim avFiles() As Variant
    Dim vFile As Variant
    Dim lFile As Long
    Dim wb As Excel.Workbook
    sDir = Dir(csFolder & "*")
    Do While sDir <> ""
    lFile = lFile + 1
    ReDim Preserve avFiles(1 To lFile)
    avFiles(lFile) = csFolder & sDir
    sDir = Dir
    Loop
    pQuickSort avFiles
    Application.ScreenUpdating = False
    For Each vFile In avFiles
    Set wb = Workbooks.Open(vFile)
    Debug.Print wb.Name
    Call Macro1
    wb.Close SaveChanges:=False
    Next vFile
    Application.ScreenUpdating = True
    End Sub
    Sub Macro1()
    End Sub
    Private Function pQuickSort(vSort As Variant, _
    Optional vLow As Variant, _
    Optional vHigh As Variant) As Variant
    'Ordena um vetor utilizando um algoritmo do tipo Quick Sort.
    Dim vPivot As Variant
    Dim vSwitch As Variant
    Dim lLow As Long
    Dim lHigh As Long
    If IsMissing(vLow) Then vLow = LBound(vSort)
    If IsMissing(vHigh) Then vHigh = UBound(vSort)
    lLow = vLow
    lHigh = vHigh
    vPivot = pTransform(vSort((vLow + vHigh) \ 2))
    Do While lLow <= lHigh
    Do While pTransform(vSort(lLow)) < vPivot And lLow < vHigh
    lLow = lLow + 1
    Loop
    Do While vPivot < pTransform(vSort(lHigh)) And lHigh > vLow
    lHigh = lHigh - 1
    Loop
    If lLow <= lHigh Then
    vSwitch = vSort(lLow)
    vSort(lLow) = vSort(lHigh)
    vSort(lHigh) = vSwitch
    lLow = lLow + 1
    lHigh = lHigh - 1
    End If
    Loop
    If vLow < lHigh Then pQuickSort vSort, vLow, lHigh
    If lLow < vHigh Then pQuickSort vSort, lLow, vHigh
    End Function
    Private Function pTransform(vItem As Variant) As Long
    Dim aux As String
    aux = vItem
    aux = Mid(aux, Len(csFolder) + 1)
    aux = Split(aux, "-")(0)
    pTransform = aux
    End Function
    Felipe Costa Gualberto - http://www.ambienteoffice.com.br

  • Can i count row from ResultSet ?

    I would like to count row from ResultSet for
    take it into my array object because i must know number of row before create array object.
    Example:
    ResultSet rset = stmt.executeQuery("select * from user ");
    /*i = amount of ResultSet*/
    User[] user = new User;
    int l=0;
    while (rset.next()){
    user[l] = new User();
    user.name = rset.getString(1);
    l++;

    Hi,
    As per my knowledge there is no method by which you can get the count of items in a resultset directly. You will have to loop through the reseltset and set a variable for count. In your specific case I would advise you to use a Vetor instead of an array so that you need not bother about the size.
    ResultSet rset = stmt.executeQuery("select * from user ");
    Vector user = new Vector();
    while (rset.next()){
    user.addElement(rset.getString(1));
    Now you will have a Vector that holds the user info. To retrieve the user info loop through the Vector.
    for (int i; i<user.size(); i++){
    userName = user.elementAt(i);
    Hope I was of some help.
    cheers!!!
    Nish

  • Unchecked Call to addElement(E)(resultset with vector)

    Please i am trying to retreive a number of rows with two columns and am trying to add it into a vector object and ots been giving me this error message.
    Unchecked call to addElement(E)
    my code will appear below
    import java.io.*;
    import java.sql.*;
    import com.ecom.util.*;
    import java.util.Vector;
    public class ProdCategory implements Serializable
         Vector catid=new Vector();
         Vector catname=new Vector();
         EcomConnection econ;
         Connection con=null;
         ResultSet rs=null;
         Statement stat = null;
    /*The following method is used to retrieve the values of category Id and category name from CategoryDet table */
         public String getselect()
              try
                   System.out.println("Getting IN");
                   econ = new EcomConnection();
                   con=econ.getConnection();
                   stat=con.createStatement();
                   System.out.println("Connected...");
                   String query="select Ctgry_Id,Ctgry_Name from CategoryDet";
                   System.out.println("Executing Query");
                   rs=stat.executeQuery(query);
                   System.out.println("Executing result set");
                   while(rs.next())
                        catid.addElement(rs.getString(1));
                        catname.addElement(rs.getString(2));
                   System.out.println(" ");
                   rs.close();
                   stat.close();
                   econ.releaseConnection();
                   System.out.println("Connection Closed");
                   return " ";
              catch(SQLException sqlex)
                   System.out.println("There is some problem in SQL Execution..." + sqlex);
                   return "There is some problem in SQL Execution..." + sqlex;
              catch(Exception ex)
                   System.out.println("There is some other problem " + ex);
                   return "There is some other problem ..." + ex;
         /*The following method is used to get the value of catid variable*/
         public Vector getcatid()
              return catid;

    i mearnt to say warning not errors i tried to typecast
    as in: Vector<string> catid=new Vector();
    Vetor<String> catname=new Vector();
    its stop giving me a warning but didnt work at run-time..it was saying nullpointer exception i need assitance

Maybe you are looking for