Pass a struct type parameter to dll

Hi
I have a 3rd party dll, which has a function that expects a struct parameter. The struct looks like this:
typedef struct _FIFO_RECORDW {
    ULONG  PortAddr;
    ULONG   NumPorts;
    USHORT Buf[1];
} FIFO_RECORDW, *PFIFO_RECORDW;
So the 3rd member is an array. When I call this function normally from C, my code which works properly looks like this:
PFIFO_RECORDW pRead_fifo;
pRead_fifo = (PFIFO_RECORDW)malloc( 2 * sizeof(ULONG) + sizeof(USHORT)* 32768);
pRead_fifo->PortAddr = ATA_DATA;
pRead_fifo->NumPorts = (16384);
ReadPortWFIFO ( hw_ctrl, pRead_fifo); // THIS IS THE ONE WHICH I WANT TO CALL FROM LABVIEW
Basically ReadPortWFIFO reads WORDs from a port and puts them into Buf[ ]. So as I said, called from C code it works.
The problem is, that I want to call this function from LabView. I tried the following things, regarding the second parameter:
1. I created a cluster which looks the same as this C struct. Then I used a Flatten to String, and I made a CString from it. I did it as it is described in "Using external code in LabView.pdf / Using the Flatten to String function" I passed this C string as a C string from the CLFN to the function. Does not work.
2. Same way, but from the flattened string I created an array of U8, and passed it as an Array from the CLFN to the function. (As array data pointer). Does not work too.
3. Then I connected the already created cluster to the CLFN as a parameter. I set the parameter type to "Adapt to type" and the data format to "Handles by value". No success.
Using any of these 3 variations will call the function without crashing LabView, so I think there is no memory allocation problem happening. But it looks always that the function is not executed. For sure that is a problem with the second parameter.
I would appreciate your help.
regards
Gyula 

Hi tbob,
I Tried what you wrote, but something is still not working. So I decided to call ReadPortWFIFO from C, and look how the struct look like. The first address is Buf[i-16], while I wanted to know how the two other U32 parameter are displayed, and maybe some header information about the struct. The part of the code is this:
ReadPortWFIFO (hw_ctrl, pRead_fifo);
    for(i=0; i<100; i++){
    ptrdataA[i]=pRead_fifo->Buf[i-16];
Then I call a dummy function ParamCompare() from labview, passing the same parameter as ReadPortWFIFO() needs. I fill a similar array as before (also pre-initialized in LV), to find the difference between the two parameter passing.  
extern "C" __declspec(dllexport) void ParamCompare(HANDLE hw_ctrl, PFIFO_RECORDW pRead_fifo, USHORT *Array){
 ULONG i;
 for(i=0; i<100; i++){
  Array[i]=pRead_fifo->Buf[i-16];
The array called ptrdataA (USHORT in HEX, note that Buf[] is USHORT type with 2048=0x0800 elements) in the first column. The one filled by the ParamCompare() is in the second column.
[0x0000]    [0x0000]
[0x0000]    [0x0000]
[0x0000]    [0x0000]
[0x0000]    [0x0000]
[0x0008]    [0x0000] - here...what is 0x0008? Differs.
[0x0100]    [0x0000] - differs
[0x0001]    [0x0000] - differs
[0x0000]    [0x0000]
[0x002C]    [0x0000] - differs***
[0x0000]    [0x0000]
[0xFDFD]    [0x0000] - differs
[0xFDFD]    [0x0000] - differs
[0x0170]    [0x0170] - LO word of PortAddr. OK!
[0x0000]    [0x0000] - HI word of PortAddr. OK!
[0x0800]    [0x0800] - LO word of NumBytes. OK!
[0x0000]    [0x0000] - HI word of NumBytes. OK!
[0xXXXX]    [0xXXXX] - This is already the Buf[0], also OK!
What are the first 12 words of the first array? Maybe these have nothing to do with the parameter, they are something else for the C code from the memory. And the value of the word which I marked with *** is incremented at each call. (?)
The fact is, when I call this func from C, it works, called from LV not. I don´t want to write a 2nd dll which calls this function. I want to use it directly from LabView.
Any idea? Or is it fool what I wrote? I am just curious...

Similar Messages

  • Pass TestStand error type directly into function parameter

    Hi,
    I am using TestStand 4 and Labwindows CVI 8.5.
    I wonder if it is possible to pass Standard Step error type into CVI function parameters.
    I think it would be more simple to pass one parameter instead of passing Error code, Error occurred state and Error message into function prototype.
    I tried to use tsErrorDataType struct defined into tsutil.h into my function prototype.
    In TestStand, I pass Step error type into function parameter but it does not work.
    TestStand displays an error meaning parameters does not match function prototype.
    Thank you for your help.

    Hi Tartempion,
    In order to pass the TestStand Error Container as one parameter to a function in a CVI DLL, you must use a struct that is typedef'ed and create an .fp file that is included as a type library for the DLL. When you create a .fp file to add to a DLL, the DLL will not build unless all structs/enums are typedef'ed. Thus, I wouldn't advise using the tsutil.h because you would have to go through and typedef every single struct and enum in the header file.
    Instead, you can simply create a typedef'ed struct in your projects header file and create an .fp file with the struct specified as a data type. Then in TestStand, when you call the function you would need to ensure that the parameter is of Category "C Struct", and type "Error". The attached zip file contains a CVI 8.5 project that demonstrates this along with a TestStand 4.0 sequence file that demonstrates how to pass the parameter to the function by reference. In case you run into trouble creating the .fp file please refer to the following KnowledgeBase. The instructions are for enums but easily correspond to structs as well:
    TestStand and LabWindows/CVI Enumeration Data Types
    Hope this helps!
    Manooch H.
    National Instruments
    Attachments:
    PassTSError.zip ‏19 KB

  • Pass a record type vaiable in out parameter of a function in a package

    Hi All,
    1.I have created a ecod inside a package.
    2.Then created a function which has a out parameter of the above record.
    3.Now package body i'm creating a dynamic cursor .
    4.My equirement is to fetch this dynamic cursor's value into the out parameter of the function.
    I have created the below code for 1,2 and 3 but not getting how to achive the point 4.
    create package pkg
    type t_rec is recod (id number,id_name varchar2(10));
    type t_data is table of t_rec index by binary_integer;
    act_data t_data;
    funcion return_data is (dept in number,region in number,o_rec out t_data) return boolean;
    end pkg;
    create package body pkg
    funcion return_data is (dept in number,region in number,o_rec out t_data) return boolean is
    p_cur sys_refcursor;
    l_text varchar2(100);
    begin
    -- As per my requirement i have built a dynamic l_text which contains where clause by taking dept and region values.In actual i have nearly 10 in paramaters with >which i'm building a dynamic where clause in l_text. So i'm using a ref cursor.
    open p_cur for 'select id,id_name from tab1'||l_text';
    fetch p_cur bulk collect into act_data;
    exception ....
    end pkg;Now as per the code snippet i could fetch all the rows returned by p_cur into act_data.
    But how i will pass it though out parameter in the function which i will use somewhere in front end to show data.
    Please help me in this.
    Thanks in advance.

    bp wrote:
    i need to create the where clause one the basis of the values of IN parameters.Sometimes i need to take count of the data on the basis of the IN parameters and if one of the conditions return value i will build where clause with those parameters.Please google and read up on the importance of creating shareable SQL - which needs to be done using bind variables.
    The ref cursor interface in PL/SQL only support a static/fixed number of bind variables. So if you want to create cursors with variable number of bind values, you need to use conditional processing. E.g.
    SQL> create or replace procedure EmpFilter( c OUT sys_refcursor, nameFilter varchar2, jobFilter varchar2 ) is
      2          sqlSelect       varchar2(32767);
      3  begin
      4          --// we pretend to built a dynamic SQL statement - so the table
      5          --// name and so on is "unknown"
      6          sqlSelect := 'select * from emp ';
      7          case
      8                  when nameFilter is null and jobFilter is null then
      9                          open c for sqlSelect;
    10
    11                  when nameFilter is null and jobFilter is not null then
    12                          sqlSelect := sqlSelect||'where job like :filter';
    13                          open c for sqlSelect  using jobFilter;
    14
    15                  when nameFilter is not null and jobFilter is null then
    16                          sqlSelect  := sqlSelect||'where ename like :filter';
    17                          open c for sqlSelect  using nameFilter;
    18
    19                  when  nameFilter is not null and jobFilter is not null then
    20                          sqlSelect  := sqlSelect||'where ename like :filter1 and job like :filter2';
    21                          open c for sqlSelect  using nameFilter, jobFilter;
    22
    23          end case;
    24
    25          DBMS_OUTPUT.put_line( 'Dynamic SQL: '||sqlSelect );
    26  end;
    27  /
    Procedure created.
    SQL>
    SQL>
    SQL> var c refcursor
    SQL> begin
      2          EmpFilter( :c, 'A%', null );
      3  end;
      4  /
    Dynamic SQL: select * from emp where ename like :filter
    PL/SQL procedure successfully completed.
    SQL> print c
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7499 ALLEN      SALESMAN        7698 1981/02/20 00:00:00       1600        300         30
          7876 ADAMS      CLERK           7788 1987/05/23 00:00:00       1100                    20
    SQL>
    SQL> begin
      2          EmpFilter( :c, null, 'ANALYST' );
      3  end;
      4  /
    Dynamic SQL: select * from emp where job like :filter
    PL/SQL procedure successfully completed.
    SQL> print c
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7788 SCOTT      ANALYST         7566 1987/04/19 00:00:00       3000                    20
          7902 FORD       ANALYST         7566 1981/12/03 00:00:00       3000                    20
    SQL>And this approach is for external clients - where a Visual Basic or Java client program calls the database, executes the stored procedure, and receives a cursor handle in turn. And the client then fetches the output of this cursor and process it.
    There is no need to return a record type of any sorts. The client wants the cursor handle as that is the optimal and best interface for the client to receive database data.
    If the caller is not an external client, but another PL/SQL procedure, then this approach does not make much sense.
    It is important that you understand basic Oracle concepts and fundamentals. What a cursor is. What the best way is to process Oracle data. How to best use the basic features of Oracle. Without that basic understanding, you as good as a low hour Cessna pilot getting into an Airbus A400M - where the Cessna pilot would not even be able to start a single engine, never mind get the plane in the air.
    Likewise, without a basic understanding of Oracle cursors and fundamentals, you will be unable to code even a single line of sensible code. Not because you are a bad programmer. Even the best programmer in the world will be unable to write decent code, if the programmer has no idea how the environment works, what the concepts and fundamentals are. But it is fair to expect that a good programmer will no write such code, understand that there is a lack of knowledge, and address that accordingly.

  • Passing Record type parameter from one session to other session

    Hi,
    I have a package.procedure, in that I am calling custom workflow, inside this workflow again I am calling
    same package.procedure (Its an recursive call)
    I need to pass record type parameter in this package.procedure.
    I tried with global variables but Workflow starts its new session so it losses all variables.
    Now I am going with creation of Custom table.
    Please advice, is there any way other than creation of Custom table.
    I mean can we pass Record type parameter from one session to other session without creating table.
    Regards
    Rohit

    Al-Salamu Alikum We Rahmatu Allah We Barakatu...
    want this place from to be passed as a parameter to the shipping bill form..... using web.show_documentwhy don't u think of just passing data parameter or global parameters from one form to another
    Pass global variable between two forms.
    Hope this helps...
    Regards,
    Abdetu...

  • Call library with struct as parameter - several problems

    Hi everyone,
    I'm trying to send a MIDI sysex message to a midi device through winmm.dll using MidiOutLongMsg. I have trouble figuring out how to pass the parameters right.
    I need to call three functions (midiOutPrepareHeader, midiOutLongMsg, midiOutUnprepareHeader), all of them having the same form
    MMRESULT midiOutPrepareHeader(
    HMIDIOUT hmo,
    LPMIDIHDR lpMidiOutHdr,
    UINT cbMidiOutHdr
    where HMIDIOUT hmo is a handle that I have already. Troubling me are the other two parameters. cbMidiOutHdr is the size (in bytes) of the struct lpMidiOutHdr. This is a struct of the form
    typedef struct {
    LPSTR lpData;
    DWORD dwBufferLength;
    DWORD dwBytesRecorded;
    DWORD_PTR dwUser;
    DWORD dwFlags;
    struct midihdr_tag far * lpNext;
    DWORD_PTR reserved;
    DWORD dwOffset;
    DWORD_PTR dwReserved[4];
    } MIDIHDR;
    (Struct: http://msdn2.microsoft.com/en-us/library/ms711592.aspx
    PrepareHeader http://msdn2.microsoft.com/en-us/library/ms711634.aspx
    SendMessage http://msdn2.microsoft.com/en-us/library/ms711629.aspx
    UnprepareHeader http://msdn2.microsoft.com/en-us/library/ms711641.aspx)
    [Note: The full code for what I want to do can be found here http://www.borg.com/~jglatt/tech/lowmidi.htm (section "outputting system exclusive MIDI messages) - basically I need a translation of this code to LabView.]
    The following are my problems:
    a) How do I emulate a struct in LabView? (other threads suggest that this is done by clusters)
    b) How do I pass a pointer to a struct (cluster?) to a DLL?
    c) If I can use a cluster for this struct, how do I represent the LPSTR lpData in the cluster, i.e., a pointer to my data?
    d) how do I get the struct size for cbMidiOutHdr?
    This is how far I got, lots of it with the help of several threads in this forum:
    a) use a LabView cluster
    b) use "adapt to type" in the dll call (couldn't get this to work)
    c) I use a type cast on my string in the hope that what it returns is the register address (and I'm probably superwrong here)
    d) my cluster consists of 9 elements of 4 byte datatypes, so I just use 36 for cbMidiOutHdr
    The dll seems to be happy with the way I pass the cluster - I get error codes of 0 in both the PrepareHeader and UnprepareHeader functions. However, sending doesn't work (error code 7). Guessing that the type cast returns a pointer, I have also cast the cluster to an Int32 and passed that parameter as pointer to numeric value. Interestingly, the PrepareHeader and UnprepareHeader functions are still happy, but I get a different error code from the sending (code 11)
    Most of what I've done so far is guesswork, and I'm out of guesses now. I've attached the code to this post (it uses VIs from the NI MIDI example library ftp://ftp.ni.com/pub/devzone/epd/midi-example.llb ). I'd appreciate any help with this. Thanks!
    Attachments:
    Write MIDI SysEx Message.vi ‏21 KB

    First off, this problem doesn't have anything to do with control references; those have meaning only inside of the LabView environment.
    My first suggestion is to look for a higher-level library that will do whatever MIDI function you are trying to call. If you can find an ActiveX or .NET object that will control the MIDI subsystem, I recommend that you use it instead since it will be a lot easier.
    If calling the DLL directly is the best option (and calling DLLs is absolutely the way to go when you need high performance) then you need to understand how LabView passes data to library functions. That is described here:
    http://zone.ni.com/reference/en-XX/help/371361D-01/lvexcodeconcepts/configuring_the_clf_node/
    As you can see there are a lot of ways to pass data, but they boil down to this: LabView can pass, via various levels of dereferencing, a pointer to some [mostly] flat data. Things are easiest when your DLL mimics LabView's own data storage methods. For example, wiring a cluster into a node set with Adapt to Type passes a handle (struct**, pointer to pointer to [mostly] flat data). So if you are writing your own DLL, it's pretty easy to write something that works nicely with LabView data (e.g., strings with 4-byte length headers, self-describing arrays) and in fact the result is cleaner looking than its "pure C" variant because of the self-describing arrays and string length prefixes. (I say "mostly" flat because LabView clusters with variable-length elements aren't stored in a flat format.)
    When it comes to matching someone else's API things get harder, and in this case you are out of luck; you are going to have to write a LabView-callable wrapper function in C because LabView can't mimic the exact data structure needed. The problem is not the struct; there is a sneaky way to pass a pointer (vs a handle) to a struct, which is to do this:
    Generate a cluster in LabView representing the struct (atomic numeric data only! no strings arrays etc!)
    Flatten to string using native byte order.
    Convert string to byte array.
    Configure the call library function note to accept a pointer to an unsigned byte array. (NOT a C-string as suggested at the bottom of the page in the link above; your data may have internal 0x00s, and it certainly doesn't need an extra 0x00 at the end!)
    The reason this works is that a pointer is just an address; as long as all the right bytes are in memory in the right order starting at that address, all is well. The DLL doesn't know that LabView thinks it is passing a pointer to an array of bytes, it just gets the pointer to the first byte and it reads and interprets those bytes according to its own struct def. Reverse the process cooming back from the DLL (convert byte array to string, unflatten from string against the LV cluster.) This method will work for any flat struct.
    In LabView 8.5 there may be a less bogus way of doing this, which is to pass the cluster in with Adapt to Type and select "Array Data Pointer" as the format. This is new and I haven't tried it.
    But in your case, you want to point to a struct that contains a pointer to a string plus some numeric data and another pointer, and this you can't do directly. LabView does not expose the location of a string to you anywhere outside the Call Library Function node, so there's no way to "find the pointer" to a LabView string from outside the DLL. What you need to do in this case is write a wrapper function in C that takes your LabView data. Only then will LabView "tell you where the bytes are" and promise not to fiddle with them until the library call is complete. Once you are in C-land, you can throw pointers around to your heart's content. As long as you do it all perfectly, all will be well. (If you write one byte too many on output, boom! :-)
    There are a few ways to do this. You could make a cluster that has meaning in LabView, e.g. replace lpData with a LabView string, then pass the cluster in to your wrapper function set to "Adapt to Type"; that will pass a handle to the cluster. You can generate the .c file from the Call Lib Fuction, and it will outline where the data is.
    Complications: In this case it's your job to convert the handle to the labview string (which has 4 bytes of length as a prefix and no trailing 0x00) to a C-string by malloc()'ing a new buffer and memcopying the string out. There might be something in the LV CIN tools that does this, I'm not sure. Make sure you release the new string after the MIDI call.
    The lazy route (which is what I would do) is pass the string as the first arg and all of the numeric stuff as the second arg, leaving the space for lpData as you have now. (I don't know what struct "midihdr_tag" is, but if that's not something you were passed in a previous call, you'll need to add a third argument for that cluster and treat it similarly.) Then you can tell LabView that it should pass the string arg as a C-string pointer. Inside your wrapper, extract the pointers and stuff them into the data structure as needed. Dereference once (to go from handle to pointer) and make the MIDI call. To be clean, put everything back where it was before in the cluster; in particular don't believe you can pass out lpData* and do whatever you want with it in LabView; LabView will release/change that address as soon as you leave the output string unwired or do anything to it (e.g. concatenate.) You'll be creating a new string buffer and a new pointer on your next MIDI call.
    All of this complication is a result of a) LabView's hiding the details of memory allocation/deallocation from you and b) LabView's internal data structures being a bit different from C conventions (e.g. LabView strings vs. C strings). The second means that even when LabView is using non-flat data structures (e.g. cluster containing an array), you can't just blindly pass them along to a C function and expect it to work right. It would be nice if NI would write a little mini-compiler into the Call Library Function that would do what our wrapper function is going to do, but that's probably a fairly significant project. 
    Still, each function wrapper is only going to have about 10 lines of C. You can put wrappers for all the MIDI functions you want to call into a single DLL, then ship that DLL with your app.
    (Now you see why I suggested you look for an ActiveX MIDI control!)
    -Rob Calhoun

  • Passing a struct from TestStand to LabWindows/CVI

    I am passing a struct to a dll written in CVI.
    Here is the problem: The code is written in CVI (c code) if I use "struct MyStruct *MyData" as the parameter definition in the dll TestStand works fine. But if I define my struct using a typedef (i.e. typdef struct MyStruct) then use MyStruct *MyData as the parameter TestStand throws a warning. 
    I an using the C\C++ adaptor.
    It is too late in the programming effort to go back and remove the typedef.
    So, how do I get TestStand to accept the typedef?
    Thanks
    Carmine
    Solved!
    Go to Solution.

    In ANSI C, the struct names and type names belong to separate namespaces. You can declare structs several different ways:
    1) struct structName { int x; };
    2) typedef struct { int x; } typedefName;
    3) typedef struct structName { int x; } typedefName; // Note: structName can be same as typedefName.
    I'm assuming you are using the 2nd example above in which case LabWindows/CVI automatically generates a struct name (something like __unknown_1) that Testand uses.
    Although you said it is too late to remove the typedef, can you add a struct name as in example 3 above? You can use the same name as the typedefName and TestStand will recognize it.

  • Is possible to pass array/list as parameter in TopLink StoredProcedureCall?

    Hi, We need to pass an array/List/Vector of values (each value is a 10 character string) into TopLink's StoredProcedureCall. The maximum number of elements on the list is 3,000 (3,000 * 10 = 30,000 characters).
    This exposed two questions:
    1. Is it possible to pass a Vector as a parameter in TopLink's StoredProcedureCall, such as
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("STORED_PROCEDURE_NAME");
    call.addNamedArgument("PERSON_CODE");
    Vector strVect = new Vector(3000);
    strVect.add(“ab-gthhjko”);
    strVect.add(“cd-gthhjko”);
    strVect.add(“ef-gthhjko”);
    Vector parameters = new Vector();
    parameters.addElement(strVect);
    session.executeQuery(query,parameters);
    2. If the answer on previous question is yes:
    - How this parameter has to be defined in Oracle’s Stored Procedure?
    - What is the maximum number of elements/bytes that can be passed into the vector?
    The best way that we have found so far was to use single string as a parameter. The individual values would be delimited by comma, such as "ab-gthhjko,cd-gthhjko,ef-gthhjko..."
    However, in this case concern is the size that can be 3,000 * 11 = 33, 000 characters. The maximum size of VARCHAR2 is 4000, so we would need to break calls in chunks (max 9 chunks).
    Is there any other/more optimal way to do this?
    Thanks for your help!
    Zoran

    Hello,
    No, you cannot currently pass a vector of objects as a parameter to a stored procedure. JDBC will not take a vector as an argument unless you want it to serialize it (ie a blob) .
    The Oracle database though does have support for struct types and varray types. So you could define a stored procedure to take a VARRAY of strings/varchar, and use that stored procedure through TopLink. For instance:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("STORED_PROCEDURE_NAME");
    call.addNamedArgument("PERSON_CODE");
    oracle.sql.ArrayDescriptor descriptor = new oracle.sql.ArrayDescriptor("ARRAYTYPE_NAME", dbconnection);
    oracle.sql.ARRAY dbarray = new oracle.sql.ARRAY(descriptor, dbconnection, dataArray);
    Vector parameters = new Vector();
    parameters.addElement(dbarray);
    session.executeQuery(query,parameters);This will work for any values as long as you are not going to pass in null as a value as the driver can determine the type from the object.
    dataArray is an Object array consisting of your String objects.
    For output or inoutput parameters you need to set the type and typename as well:
      sqlcall.addUnamedInOutputArgument("PERSON_CODE", "PERSON_CODE", Types.ARRAY, "ARRAYTYPE_NAME"); which will take a VARRAY and return a VARRAY type object.
    The next major release of TopLink will support taking in a vector of strings and performing the conversion to a VARRAY for you, as well as returning a vector instead of a VARRAY for out arguments.
    Check out thread
    Using VARRAYs as parameters to a Stored Procedure
    showing an example on how to get the conection to create the varray, as well as
    http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/varray/index.html on using Varrays in Oracle, though I'm sure the database docs might have more information.
    Best Regards,
    Chris

  • How to pass RECORD input type to stored procedure from JDBC?

    Hi,
    We have stored procedure which takes RECORD as input .
    We could execute the below script from oracle client tool and get the response.
    declare
    l_record app.batch_update.add_record;
    l_id number;
    begin
    -- memberNumber
    l_record.no := '123456700';
    -- Policy Number
    l_record.pno := '1234567'
    -- Status. This will always be NEW.
    -- Call to API to add record
    app.batch_update.add_request
    (p_record => l_record,
    p_id => l_id,
    end;
    We have requirement to construct RECORD input from Java application and pass it to callable statement.
    We have tried to construct it via STRUCT and pass it to callable statement but it didn't work.
    We have constructed it like the following but not sure whether it is correct. It was throwing error "java.sql.SQLException: invalid name pattern: app.batch_update.add_record
    StructDescriptor structdesc = StructDescriptor.createDescriptor
    ("app.batch_update.add_record", delConn);
    Object[] p1obj = {' 12345','124050'};
    STRUCT p1struct = new STRUCT(structdesc, delConn, p1obj);
    Not sure whether I am doing the logic correctly.
    Please point me to the correct approach.
    Thanks in Advice
    Thanks

    Wrap the method using a record-type parameter in PL/SQL; a simplified example follows. Add exception handling, translation of types etc. as needed.
    CREATE OR REPLACE PROCEDURE prc_wrap_prc_using_rec
    pv_my_field_01 IN VARCHAR2,
    pv_my_field_02 IN VARCHAR2,
    pv_my_field_99 IN VARCHAR2,
    pv_err_msg OUT VARCHAR2
    ) AS
    -- Non-scalar parameter
    pr_my_record user.pkg_rec_declarations.wr_a_record_decl;
    BEGIN
    -- Load the work record
    pr_my_record.pv_field_01 := pv_my_field_1;
    pr_my_record.pv_field_02 := pv_my_field_2;
    pr_my_record.pv_field_99 := pv_my_field_99;
    -- Call the procedure
    pkg_std_routines.prc_do_sumfin(pr_my_record, pv_err_msg);
    END;

  • How can I pass a Variant to a C++ DLL from TestStand?

    I have a VARIANT that is being returned to TestStand via COM. The variant contains a structure of integers and strings. The integers are not uniformly sized... some are 8,16, and 32 bit. Rather than try to find a way to decode this information in TestStand, I would like to pass it to a C++ DLL to do the decoding and return the information in a readily usable format. I also have need to take the aforementioned data types, send them to a DLL for conversion into a VARIANT, and then pass this variant to a COM object. Can someone please explain a way that I can use TestStand as a pass-through for VARIANTs between a COM object and a C++ DLL?

    Hi,
    To pass a VARIANT to a C++ DLL in TestStand, you will need to create a custom data type.  From the sequence, change the View ring to Sequence File Types.  Right-click to insert a new Customer Data Type and select Container.  Now you can right-click to insert a field, which you can specify what data type it is.  Insert as many fields as needed.  After you have entered those in, right-click on the Custom Data Type name and select Properties.  Go to the C Struct Passing tab and click the "Allow Objects of this Type to be Passed as Structs".  Change packing to correlate with the C++ compiler you are using and also configure the properties for each field.
    Once you have done this, you will be able to pass that VARIANT as a struct to a C++ DLL.
    Thanks,
    Terry S.
    Staff Software Engineer
    National Instruments

  • Where do we pass tax condation type and condation value in this bapi: SD_SALESDOCUMENT_CHANGE

    Hi Experts,
    I am using this to change sales order. SD_SALESDOCUMENT_CHANGE
    I am passing condation type and condation values for each line item under table parameter CONDATION_IN.  Here in which fields do i need pass tax condation type and condation value.
    please give me suggestion it is really help ful.
    Thanks
    laxmi

    Hi ,
    Pass condition type and condition value in fields COND_TYPE and COND_VALUE under table parameter CONDATION_IN. Also pass 'X' to above fields in table parameter of CONDITIONS_INX.

  • How to Pass a multi-select parameter in BI to a PL/SQL Program

    I am trying to pass a BI report parameter which is multi-select enabled in BI Enterprise Stand-Alone reporting tool. eg. it comes out in the data model like this: <P_CLASS_CODE>[DISABLED_VETERAN_OWNED, HUB_ZONE, LARGE_BUSINESS]</P_CLASS_CODE>
    to a pl/sql stored procedure. (this is some kind of record set)
    This works when passing the parameter as bind variable being passed to and IN CLAUSE. However, In my case I need a little bit more flexibilty with the programming so I need to get the value into PL/SQL so I can work with the individual values in the record set.
    I am trying to figure out which collection type or record type I can use in pl/sql to be able to parse out the elements in the collection from within a stored procedure so I can loop through the elements.
    I am trying to call the BI before report trigger in the data template like this:
    <dataTrigger name="beforeReportTrigger" source="XXAPRPT03_SUPPLIER_DIVERSITY.before_report_trigger(:p_class_code)"/>
    this call refers to the default package
    I get this error: 'Invalid column type'
    what type should I be using in my procedure definition to support the multi-selection record set which my parameter is passing from BI.

    Hi,
    Okie :) please feel free to post any problem :)
    Please apply the patch that has the fix for this issue:
    [Patch 9791839|https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=9791839]
    The above link worked fine for me .
    Ideally, you should pick up the latest patch, which is [ Patch 11846804|https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=11846804]
    Click on View Read me for install instructions. Let me know if you find any problem with patch install.
    Regards,
    Ajay Kumar

  • How to pass more than one parameter

    Hello,
    This is my code.
    How to pass more than one parameter:
    SELECT:responsibility_name responsibility_name,
    LPAD(' ', 6*(LEVEL-1))
      || menu_entry.entry_sequence sequence ,
      LPAD(' ', 6*(LEVEL-1))
      || menu.user_menu_name SubMenu_Description ,
      LPAD(' ', 6*(LEVEL-1))
      || func.user_function_name Function_Description ,
      LPAD(' ', 6*(LEVEL-1))
      || menu_entry.prompt prompt
      ,menu.menu_id ,
      func.function_id
      --menu_entry.grant_flag Grant_Flag ,
      --DECODE( menu_entry.sub_menu_id , NULL, 'FUNCTION' , DECODE( menu_entry.function_id , NULL, 'SUBMENU' , 'BOTH') ) Type
    FROM fnd_menu_entries_vl menu_entry ,
      fnd_menus_tl menu ,
      fnd_form_functions_tl func
    WHERE menu_entry.sub_menu_id    = menu.menu_id(+)
    AND menu_entry.function_id      = func.function_id(+)
    AND MENU.LANGUAGE(+) = 'US'
    AND FUNC.LANGUAGE(+) = 'US'
    --AND func.user_function_name LIKE '%Primary Care Providers%'
    AND grant_flag                  = 'Y'
      START WITH menu_entry.menu_id =
      (SELECT menu2.menu_id
      FROM fnd_menus_tl menu2,apps.fnd_responsibility_vl resp
      WHERE menu2.menu_id=resp.menu_id
      and resp.responsibility_name= :responsibility_name
      --and menu2.user_menu_name = ('ATCO HR INQ USER'
      AND LANGUAGE = 'US'
      CONNECT BY MENU_ENTRY.MENU_ID = PRIOR MENU_ENTRY.SUB_MENU_ID
       and menu_entry.function_id not in (select func.function_id
                                       from --fnd_form_functions_vl fnc,
                                       apps.fnd_resp_functions exc,
                                       apps.fnd_responsibility_vl res
                                      where func.function_id = exc.action_id
                                      and res.responsibility_name =:responsibility_name
                                      and res.responsibility_id=exc.responsibility_id)
      and menu_entry.sub_menu_id  not in (select menu.menu_id
                                       from --fnd_menus_vl imn,
                                       apps.fnd_resp_functions exc,
                                       apps.fnd_responsibility_vl res
                                       where menu.menu_id = exc.action_id
                                       and res.responsibility_name =:responsibility_name
                                      and res.responsibility_id=exc.responsibility_id)
    ORDER SIBLINGS BY menu_entry.entry_sequence;
    Thank you for your help
    Shuishenming

    Hi, Ming,
    One way is to put the "parameters" in a table, and join to that table in your query.  If you make it a Global Temporary Table, then multiple sessions can run the query at the same time, and each can be seeing different responsibilities.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.  Since this problem involves parameters, you should give a couple of different sets of parameters, and the results you want from the same sample data for each set.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • How to pass csv data from file into DLL using TestStand

    Hi,
    We have data files which are of CSV format. Each row contains
    about 9 items of data, and have about 5 rows of this data (ie, 5
    test points) :
    eg
    TErrAdd1,UUT,UUT,STM1E,AU4/FR,PRBS23,BIT,10,60
    TErrAdd2,UUT,UUT,STM4O,AU3/UNFR,PRBS15,B1,20,60
    TErrAdd3,UUT,UUT,STM16O,AU4_16C/UNFR,PRBS9,BIT,7,60
    TErrAdd4,UUT,UUT,STM0E,AU3/UNFR,PRBS20,B2,5,60
    TErrAdd5,UUT,UUT,STM64O,AU4_4C/FR,PRBS11,B1,6,60
    What we want to do is to be able to directly pass each
    row of data to a C/C++ DLL. The DLL fn accepts this
    data as a vector of strings.
    eg.
    void DLLTestFn( vector const & configData )
    However, we can write a wrapper for the DLL as I don't
    think TestStand will know about vectors.
    We don't really want to have to hardcode individial references
    to each item of data in TestStand. Is this possible?
    Just read in a row from a data file, and sent it direct
    to the DLL?

    Hi Richardi,
    the principle is quite simple, however, you still need to use a programming language to make the initial file read.
    Once you've done this, you could have it as an array of strings, and pass this directly to a wrapper DLL, which would then pass the data into a string vector.
    Look up the examples\AccessingArrays\PassingArrayParametersToDll\AccessingArrays.seq
    to see how to do this without passing the sequence context.
    If you've read in the details into a container type structure already, then I've made an example which demonstrates this principle and what you'll need to pass it to a vector. (Similar principle can be used to fill in the container when you read the file in the first place.
    You cannot go directly to a vector, since TestStand doesn't understand them.
    Vector classes are difficult to export polymorphically from a DLL since the template class doesn't export, and needs specifically defining. This is what I'm assuming you're ultimately trying to do. (see ref :
    How to Export STL components inside and outside of a class
    I've used VIsual C++ 6 and TestStand 3.0
    Please let me know if this helps to answer your query.
    Thanks
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer
    Attachments:
    for hannah vectors.zip ‏1619 KB

  • How to pass multi-value input parameter to SQL command

    I'm having trouble following the threads related to passing multi-value parameters to a SQL command.
    I need more details on the work-around that exists for using a dummy main report to GET the input parameters and pass them to a subreport parameter that uses the input parameters in its sql command WHERE clause.
    So far the main report prompts user to enter badge numbers into a multi-value string type parameter field called badgeNumber.
    The main report getRequesters command executes the following SQL:
    SELECT requester FROM lawprod.requester WHERE lawprod.requester.requester IN  '{?badgeNumber}'
    order by requester
    The main report also contains a formula called requesterList that concatenates the input parameters and separates the values with commas:  (Join ({?badgeNumber}, ", ")  
    So if user enters badge numbers 1 and 2 and 3 the value of requesterList is 1, 2, 3
    From the main report I've used the Insert Subreport command to choose an existing report, and used the link tab to link @requesterList to ?requester; where ?requester is a multi-value parameter that is used in the subreport's SQL query as shown below:
    WHERE (lawprod.ictrans.update_date <=  {?endDate} AND
           lawprod.ictrans.update_date >= {?startDate} AND
           lawprod.ictrans.doc_type = 'IS' AND
           lawprod.ictrans.system_cd = 'RQ' AND
           lawprod.mmdist.posting_type = 'O1')
          AND
          (lawprod.ictrans.company = lawprod.mmdist.company AND 
           lawprod.ictrans.system_cd = lawprod.mmdist.system_cd AND
           lawprod.ictrans.location = lawprod.mmdist.location AND
           lawprod.ictrans.doc_type = lawprod.mmdist.doc_type AND
           lawprod.ictrans.document = lawprod.mmdist.doc_number AND
           lawprod.ictrans.shipment_nbr = lawprod.mmdist.doc_nbr_num AND
           lawprod.ictrans.line_nbr = lawprod.mmdist.line_nbr AND
           lawprod.ictrans.component_seq = lawprod.mmdist.component_seq)
          AND
          (lawprod.ictrans.company = lawprod.reqline.company AND 
           lawprod.ictrans.document = lawprod.reqline.req_number_a AND
           lawprod.ictrans.line_nbr = lawprod.reqline.line_nbr AND
           lawprod.reqline.company = lawprod.reqheader.company AND
           lawprod.reqline.req_number = lawprod.reqheader.req_number)
           AND
           (lawprod.reqheader.requester in '{?requester}')
    Following execution of the main report, Crystal appears to prompt for three values as expected: badge numbers for the main report, and start and end dates needed by the subreport.   I can't figure out why Crystal XI returns no data. Can anyone explain what I'm missing?
    Edited by: Patricia Sims on Sep 21, 2009 9:30 PM

    The reason no data is returned is that the multiple values are not (properly?) passed to the main report's SQL.  The main report's SQL should be (MS SQL):
    select 1 as dummy
    This causes exactly one record to be returned, which will basically be ignored (except the fact that it will drive the subreport; any query that returns only 1 record will suffice...).
    Change the concatenation of the selected values to be (basic syntax):
    formula = "|" + join({?badgeNumber}, "|") + "|"
    The leading and trailing vertical bars are important (otherwise a database value of 1 might match a selection of 123).
    Pass the concatenated string as the parameter value to the subreport.  In your subreport, select records on (basic syntax):
    formula = (instr({?sr-badgeParam}, "|"+cstr({requester},"0") + "|") > 0)
    (assumes is numeric in the database, and is integer; modify or eliminate cstr() if otherwise...)
    Put your subreport on the detail format of the main report, and you're all set...
    HTH,
    Carl

  • Java call stored procedure with nested table type parameter?

    Hi experts!
    I need to call stored procedure that contains nested table type parameter, but I don't know how to handle it.
    The following is my pl/sql code:
    create or replace package test_package as
    type row_abc is record(
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    type matrix_abc is table of row_abc index by binary_integer;
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    END test_package;
    create or replace package body test_package as
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    IS
    v_sn NUMBER(8):=0 ;
    BEGIN
    LOOP
    EXIT WHEN v_sn>5 ;
    v_sn := v_sn + 1;
    p_out(v_sn).col1 := 'col1_'||to_char(v_sn)|| p_arg1 ;
    p_out(v_sn).col2 := 'col2_'||to_char(v_sn)||p_arg2 ;
    p_out(v_sn).col3 := 'col3_'||to_char(v_sn)||p_arg3 ;
    END LOOP ;
    END ;
    END test_package ;
    My java code is following, it doesn't work:
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection
    ("jdbc:oracle:thin:@10.16.102.176:1540:dev", "scott", "tiger");
    con.setAutoCommit(false);
    CallableStatement ps = null;
    String sql = " begin test_package.test_matrix( ?, ? , ? , ? ); end ; ";
    ps = con.prepareCall(sql);
    ps.setString(1,"p1");
    ps.setString(2,"p2");
    ps.setString(3,"p3");
    ps.registerOutParameter(4,OracleTypes.CURSOR);
    ps.execute();
    ResultSet rset = (ResultSet) ps.getObject(1);
    error message :
    PLS-00306: wrong number or types of arguments in call to 'TEST_MATRIX'
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored
    Regards
    Louis

    Louis,
    If I'm not mistaken, record types are not allowed. However, you can use object types instead. However, they must be database types. In other words, something like:
    create or replace type ROW_ABC as object (
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    create or replace type MATRIX_ABC as table of ROW_ABC
    /Then you can use the "ARRAY" and "STRUCT" (SQL) types in your java code. If I remember correctly, I recently answered a similar question either in this forum, or at JavaRanch -- but I'm too lazy to look for it now. Do a search for the terms "ARRAY" and "STRUCT".
    For your information, there are also code samples of how to do this on the OTN Web site.
    Good Luck,
    Avi.

Maybe you are looking for

  • Field description in two line in ALV report

    Hi , In ALV report I  want the description for each field to be displayed in two lines . For example the description for field matnr is " Material No for grade A " which is displayed in one line . But i want to display it as :  Material No           

  • Existing Function modules or Standard upload Programs

    Hi, Can any one tell, Are there any Function modules or Standard upload programs exists for following transactions: Creating production version(C223) Creating Master recipe(C201) Creation Apportionment Structure(C202) Creation BOM Allocation(CS08) (T

  • Current Date and Time in JLabel

    Hi i am fairly new to Java and i would like to know how i can get a label to show the current date and time ( with seconds) to show up in the top right hand corner. Thank you.

  • [ODBC Microsoft Access Driver] Syntax error (missing operator)

    Aello' - as you can see in my database table their are two records to delete based on the HISTORY_ID of 1. This was working just fine when I was using a MS SQL Server database but when I switched to the MS Access database I get this error now. Is the

  • Smart Object Transformation in CS5

    Has anyone noticed that when you scale down a smart object in Photoshop CS5, the transformation tool resets the dimensions to 100%? In CS4, you are able to see the transformation properties once you scale down (by option-Shift clicking on the boundin