Call toolkit vi from Diadem
Hi there,
I try to start a VI within a llb from a toolkit and it doesn't work...
The path to the VI is :
C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Addons\Time Series Analysis\Correlation and Spectral Analysis.llb\TSA Welch (waveform).vi
I try this code :
' Initialize the LVRuntime
Dim sgRunTimeVersionT : sgRunTimeVersionT = ""
LVRuntime.Init sgRunTimeVersionT
' Load "Test.VI"
Dim objVI
Set objVI = LVRuntime.LoadVI("
C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Addons\Time Series Analysis\Correlation and Spectral Analysis.llb\TSA Welch (waveform).vi")
' Call the VI
Call objVI.Run(true)
' Clean up
Set objVI = Nothing
LVRuntime.DeInit
I had
[LVRT]
libdir = "C:\Program Files\National Instrument\Labview 8.5"
in the Diadem.ini file
The error message is attached...
Please, could anyone help me !
Thank's in advance.
Attachments:
error9.JPG 17 KB
Duplicate post.
Please post answers in this thread.
Similar Messages
-
Call labview vi interactiv​ely from diadem 10
Hi, I am trying to run a LabVIEW VI from DIAdem. I have LabVIEW 7.1 loaded on my machine and got Diadem 10. I have downloaded the tool for calling LabVIEW VIs interactively from DIAdem but am unable to run my VI. Only VIs from library DIAdem_selectVIs executes. Is there any solution to call LabVIEW VI from DIAdem 10.
This is the link. Plz Check it out.
http://zone.ni.com/devzone/conceptd.nsf/webmain/1A98AB48E35D913086256E23004E6A22?opendocument&node=5050_US
Regards,
Peter.
PizzaHi Brad,
Thanks for your quick response. I worked on that example You have sent. It's working fine. I find little hard to pass my channels from Diadem to Labview and vice-versa. Can You please help me. I have attached a simple array addition Labview VI.
Cheers,
Peter
Pizza
Attachments:
pressure 2.vi 10 KB -
I am trying to run a LabVIEW VI from DIAdem. I looked in the help files but the example seems to only open LabVIEW 7.0 and not open the VI. The process stops on the LabVIEW startup screen. Also I have LabVIEW 7.1 loaded on my machine and would like to be able to select which version of LabVIEW I start with DIAdem. Is any of this possible?
Thanks in advance.
AJLHi AJL,
If your VI happens to be in the LabVIEW directory or subdirectory structure, you can use native functions in DIAdem 9.1 to call that VI from DIAdem. If the VI is further configured to run when opened, it will automatically start:
IF IsAvailLabVIEW = TRUE THEN
LVTemplatePath = "examples\DIAdem\File\File Headers\"
LVTemplateVI = "Binary File Analyzer.vi"
Call LaunchLabVIEW
END IF
Otherwise you will need to create VBScript object variables from the VI server of LabVIEW and execute their methods and set their properties to have the same remote control over the VI as you would from another VI using VI server. The example Tom pointed you to shows this in intricate detail, in the context of a very large application. Here's what VI server looks like in VBScript:
Dim lvapp, vi, viPath, paramName(0), paramVal(0)
Set lvapp = CreateObject("LabVIEW.Application")
viPath = "C:\Favorite LV Menu\Binary File Analyzer.llb\Binary File Analyzer.vi"
Set vi = lvapp.GetVIReference(viPath)
vi.FPWinOpen = True
paramName(0) = "file path"
paramVal(0) = "C:\DIAdem Hands-On\ReadMe.txt"
Call WndShow("SHELL", "MINIMIZE")
Call vi.Call(paramName, paramVal)
Call lvapp.Quit()
You can read and write more than one parameter for VIs with multiple input/output terminals. Note that the paramName() and paramVal() variables are VBScript arrays. The number of elements in these arrays does NOT have to match the number of terminals-- all you need to put in these VBScript arrays are the parameters that you care to read/write in the VI.
Ask if you have additional questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
Hello all,
I am using DIAdem 10.0 Advanced, LabVIEW 8.0 PDS. I would like to start a LabVIEW IHM from a VBS script. I use VI Server to call my VI from DIAdem.
Here is the script and the VI I use (VI attached):
Dim lvapp, vi, viPath, paramName(1), paramVal(1)
Set lvapp = CreateObject("LabVIEW.Application")
viPath = "C:\TEST\test.vi"
Set vi = lvapp.GetVIReference(viPath)
vi.FPWinOpen = True
paramName(0) = "Input"
paramVal(0) = 10
paramName(1) = "Output"
paramVal(1) = 0
Call vi.Call(paramName, paramVal)
Call lvapp.Quit()
I found a similar example on your web site.
Question 1:
I need to know the syntax for all the other properties and methods of a VI object (method like Get or Set Control Value for example).
Is a documentation (other than the LabVIEW help which is dedicated for LV programmers) exist in order to be able to use all the features of VI Server from another environment (CVI, VB, ...)?
Question 2:
Is it possible to call a VI with VI Server with the parameter "Wait until done" to FALSE? (run a VI asynchronuously from DIAdem)
Thanks for your answer.
MatthieuG
Eurilogic
Attachments:
Test.vi 9 KBHello,
I finally found a way to get the documentation of VI Server. I can view the "LabVIEW.TLB" type library file with a OLE/COM Object Viewer (a utility from the Windows SDK). -
Some errors when calling LabVIEW VIs Interactively from DIAdem
Hi! I'm having some trouble using the "Calling LabVIEW VIs Interactively from DIAdem" found on:
http://zone.ni.com/devzone/conceptd.nsf/webmain/1A98AB48E35D913086256E23004E6A22
Following the troubleshooting section didn't resolve the issue. I
recompiled and built the exe (DIAdemLabVIEW.exe) for version 7.1.1,
which I am developing on. But still I got the same error message, after
a waiting for about a minute, on a diadem popup window:
Error in <MenuAdd...ctDo.vbs (row:1, column: 1)
Error in <addmenuentry.vbs (row:14, column: 3)
ActiveX component can't create object.: 'DIAdemLabWIEV.Application'
Using the llb's and exe's that was included with the installer worked
flawless, with the exception that LV 7.1.1 vi's didn't appear on the
popup window(DIAdemLabWiev.vi). So I tried to recompile and build for
the 7.1.1, with this result.
I'd be very grateful for fixes or solutions for this problem!
Regards
Roger IsakssonBrad, thanks for the reply! Below is my (correct?) modification of your script. Have I got it right?
Dim lvapp, vi, viPath, paramName(1), paramVal(1)
Set lvapp = CreateObject("LabVIEW.Application")
viPath = "C:\TEMP\Test.exe"
Set vi = lvapp.GetVIReference(viPath)
vi.FPWinOpen = True
paramName(0) = "In Name"
paramVal(0) = "In Value"
paramName(1) = "Ut Name"
Call vi.Call(paramName, paramVal)
Call lvapp.Quit()
MsgBox "Parameter1 Value = " & paramVal(1)
I am not sure about the format of the <paramName(0) = "In Name">.
The control name is "In" and is a I32, the name for the indicator is
"Ut" and has the same storage type as the control.
Running the script gives an error in line 4, that is the <Set vi =
lvapp.GetVIReference(viPath)>. I'll attach the exe and the error
message.
I have another question regarding the relatively large amount of RAM
that diadem uses for export from my labview application to diadem. More
than 10 times the size of the data is required for exporting to diadem.
Since our application use relatively large files, actually up to
several GB's, this soon becomes problematic. See the attached picture
of the memory usage after exporting a 10MB segment (contains 42
channels of measurement data). Your help in these matters would be
appreciated!
Regards
Roger Isaksson, Damill AB
Message Edited by Roger Isaksson on 09-09-2005 10:22 AM
Message Edited by Roger Isaksson on 09-09-2005 10:22 AM
Attachments:
VBError.JPG 181 KB
Test1.vi 9 KB -
How can I call a variable from VBA in Diadem report?
Hello,
I have a script in Diadem, script that I can control from a VBA application ( from Excell), and I want to send from Excell some details to the report.
I want in the report, the Local Test Order field to by the LocalTO from the VBA (Excell), the DVM Test Order fiel to be the DVMTO from Excell, and ..... al the fields from the excell to be in the report.
And in the Diadem script the filename of the export .pdf file to be the filename from the Excell.
Attached I put the script from Diadem and the VBA application.
Thank you for your time.
Attachments:
Diadem.zip 28 KBHello Marse!
Sorry that I was not clear enough and add the hwo-to via OLE
For way 1. you have to add this lines to your Excel VBA code:
loadscript = IDIACommand.TextVarSet("T1","Value of T1")
For way 2. it is:
loadscript = IDIACommand.CmdExecuteSync("GlobalDim('MyGlobalVar'")
loadscript = IDIACommand.VariantVarSet("MyGlobalVar","Value of MyGlobalVar")
Inserted before your line
loadscript = IDIACommand.CmdExecuteSync("scriptstart('C:\BForce\LIBR\BForce2.VBS')")
Hope it is clear now! Otherwise feel free to ask
Matthias
Message Edited by Twigeater on 10-10-2008 09:43 AM
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater? -
How can i transfer filtered data from diadem to excel?
Hi,
i'm trying to write a script which would allows me to transfer data automatically from diadem to excel and i need some help.
i want to copy the last of my selected channels, open an excel file and paste data into it.
My script look like this
Dim ExcelTable
Call DATABLCLPCOPY("1,137,139,142-168,172-225,227,229,231,233,235,237,239,241,243",j,1) '... CHNNOSTR,CHNROW,VALNO
Set ExcelTable=GetObject("K:\...\Anl_kal_v3_2006.xls!SN1")
ExcelTable.Application.Visible = True
One problem is that i don't know how to continue and the other is that this script only get the programm MS-Excel started and don't open my file.
I hope i explained it the way you could understand and so you could give me ur help.
Thanks
Patrick EtoumannHi Patrick,
In DIAdem we provide an example which shows the things you would like to do. The script name is "Expl_OLE.vbs". You find it in the folder ..\Libr\Aut\.
I hope this will help you.
Greetings
Walter -
How to call Indesign Extension from C/C++
I have created Indesign extension using creative suite extension builder from my flash builder 4.6. In that extension i have "Run Indesign" button.How can i call that button from C/C++?
@T. Scheider
For Adobe CC 9.0.x-9.2.x, do I need AEDP access to download native application toolkit to compile the flex hybrid extensions?
Also is native application toolkit different for all versions of Adobe Indesign? -
I would like to run a stock analysis program called Toolkit 6 on my Macbook Pro, but it only works on the Windows platform. Is there software that allows me to run Windows applications on the Mac?
Yes it's MS Windows! You will need a license of MS Windows (preferable Windows 7) and from there you can decide on the strategy for running Windows on your iMac. You can use Boot Camp (you already have this) or you use virtualization software such as Parallels or Fusion. For your situation I'd recommend virtualization software. However for only one program I'd do some due diligence to see if there is a OS X version. You can start with the App store or simply use Google to search.
Kappy has provided a good article on running Windows on a Mac and the various options. Here is the link:
Kappy's explanation
Roger -
Calling Generator Plugins from ExtendScript
Hi,
I hope you can help me out as I'm at the end of my tether!
I'm working through the documentation on the Generators Github page, and am having difficulty getting the example for Calling Generator Plugins from ExtendScript to work.
The Extend Script is this:
var generatorDesc = new ActionDescriptor();
generatorDesc.putString (app.stringIDToTypeID ("name"), "test");
// Example of additional parameter passed to the node.js code:
generatorDesc.putString (app.stringIDToTypeID ("sampleAttribute"), "moreInfo" );
var returnDesc = executeAction (app.stringIDToTypeID ("generateAssets"), generatorDesc, DialogModes.NO);
All it is supposed to do is trigger File>Generate>test (which it wont) I have tried running it via File>Scripts>test, and through Adobe ExtendScript Toolkit CC to no avail.
I have also tried using the Scripting Listener Plug-in, but in doesn't log events from File>Generate by the looks of it.
Everything on the nodes.js side looks fine. if I manually trigger File>Generate>test , I get the correct response on the Command Line:
Menu event {"generatorMenuChanged":{"name":"test"},"timeStamp":1389725487.074}, starting state {"enabled":true,"checked":false}
Any ideas or alternative solutions?I am having the same problem as the op.
I can see from the generator architecture documentation why this is happening as photoshop creates a new menu section for each KVLR connection but i cant figure out the name of the section that photoshop assigns to my external generator-core.
I really need this functionality in my plugin and need it during development so any help would be greatly appreciated. -
Error while calling a form from another form's menu item
I created a main form and menu module for this form.
I am calling another form from main form menu item.
i moved both the forms and menu and compiled them.
But, when i run this form i am getting an error saying
FRM 92100: Your connection to the server was interrupted
This may be the result of a network error, or a failure on the server.
You will need to establish your session.
I set the seperateframe = true
networkentries = 30
But still getting the same error.
Is there any parameter that i am missing.
I will greatly appreciate if anybody can direct me to the solution.
Thank you.
Navya.Hi guest,
the data definition is:
DATA: XVBKD LIKE VBKDVB OCCURS 0 WITH HEADER LINE.
the assignment:
XVBKD-PRSDT = likp-erdat.
Thanks,
Hagit -
Error while calling a procedure from ESB
Hi,
I am calling a procedure from ESB using DB adapter. and in the routing rules i am mapping the i/p values for schema to procedure input variables using mappings(transformation) but the values are going as null to the procedure call.
Please help me out.
The exception follows...
An unhandled exception has been thrown in the ESB system. The exception reported is: "org.collaxa.thirdparty.apache.wsif.WSIFException: esb:///ESB_Projects/ESB-Issues_issue3/db3.wsdl [ db3_ptt::db3(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'db3' failed due to: Error while trying to prepare and execute an API.
An error occurred while preparing and executing the SYSTEM.INSERT_ISSUE_PROC API. Cause: java.sql.SQLException: ORA-01400: cannot insert NULL into ("SYSTEM"."ISSUES"."ISSUE_NAME")
ORA-06512: at "SYSTEM.INSERT_ISSUE_PROC", line 16
ORA-06512: at line 1
[Caused by: ORA-01400: cannot insert NULL into ("SYSTEM"."ISSUES"."ISSUE_NAME")
ORA-06512: at "SYSTEM.INSERT_ISSUE_PROC", line 16This is likely being caused by a problem that we've seen a number of times. You'll have namespace issues and problems with NULLs if your JDev is 10.1.3.1 and SOA is 10.1.3.3 (or vice-versa). You MUST synchronize JDev 10.1.3.3 (or higher) with SOA 10.1.3.3 (or higher). It doesn't matter if you mix 10.1.3.3 and 10.1.3.4. You just need to get away from 10.1.3.1.
-
Call Custom Service from Event Receiver as Current User
Hello,
i bang my head on this problem for days now:
My custom web service hosted in Sharepoint 2013 needs to know the logged on user name. I used to have a self-written impersonation in my service client before, but with switching to claims authentication this should be obsolete.
So within my service i decode the user from
IClaimsPrincipal icp = Thread.CurrentPrincipal as IClaimsPrincipal;
IClaimsIdentity ci = (IClaimsIdentity)icp.Identity;
String User = ci.ToString();
This works well when i call the service from a custom aspx page.
It utterly fails when i call the service from a List Item Event Receiver. The User always is the Application Pool Account.
This is the Client code to open the Channel:
private void SetChannelFactory(
MyServiceApplicationProxy proxy,
Uri address)
if (null == proxy)
throw new ArgumentNullException("proxy");
if (null == address)
throw new ArgumentNullException("address");
// Check for a cached channel factory
string endpointConfigurationName = GetEndpointConfigurationName(address);// Get the endpoint configuration name
if ((null == s_ChannelFactory) || (endpointConfigurationName != m_EndpointConfigurationName))
lock (s_ChannelFactoryLock)
if ((null == s_ChannelFactory) || (endpointConfigurationName != m_EndpointConfigurationName))
// Create a channel factory without specifying an endpoint address
// so it can be cached and used for multiple endpoint addresses
s_ChannelFactory = new ConfigurationChannelFactory<IMyServiceContract>(
endpointConfigurationName, proxy.Configuration, null);
// Configure the channel factory for claims-based authentication
s_ChannelFactory.ConfigureCredentials(SPServiceAuthenticationMode.Claims);
foreach (var operation in s_ChannelFactory.Endpoint.Contract.Operations)
DataContractSerializerOperationBehavior behavior = operation.Behaviors.Find<DataContractSerializerOperationBehavior>() as DataContractSerializerOperationBehavior;
if (behavior != null)
behavior.MaxItemsInObjectGraph = 2147483647;
// Store the current endpoint configuration name.
m_EndpointConfigurationName = endpointConfigurationName;
private IMyServiceContract GetChannel(
MyServiceApplicationProxy proxy,
Uri address)
//Create Channelfactory
SetChannelFactory(proxy, address);
// Create a channel from the channel factory.
return s_ChannelFactory.CreateChannelActingAsLoggedOnUser(new EndpointAddress(address));
All research pointed out that "CreateChannelActingAsLoggedOnUser" would pass the current user (which is correctly identified within the event receiver!) to the service, but it doesn't work for my event receiver...
Any advice on this would be great!
With kind regards,
JoachimYou should be able to get the current user id from the SPListItemEventProperties object. From here you should be able to create a Claim. For example get the user by using
user = SPWeb.Users.GetByID(properties.CurrentUserId)
SPClaim claim = SPClaimProviderManager.CreateUserClaim(user.email, SPOriginalIssuerType.TrustedProvider, issuerIdentifier);
https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.claims.spclaimprovidermanager.createuserclaim(v=office.14).aspx
Blog | SharePoint Field Notes Dev Tools |
SPFastDeploy | SPRemoteAPIExplorer -
Call a Vbscript from a stored procedure
Hi,
I wonder is it possible to call a Vbscript from a stored procedure, any good reference for this.
thanksWell here is quick and dirty example I just created.
Step 1. Create a test_batch.bat file that creates a folder "c:\test_dir" and copy "c:emp.lst" into it.
C:\oracle102\examples\test_batch.bat
md c:\test_dir
copy c:\emp.lst c:\test_dir
Step2. From SQLPLUS, spool scott.emp into c:\emp.lst and call the batch from the dbms_scheduler that kicks off right away,
set echo off
set feedback off
spool c:\emp.lst;
select * from scott.emp;
spool off;
begin
dbms_scheduler.create_job(job_name => 'run_batch',
job_type => 'EXECUTABLE',
job_action => 'C:\oracle102\examples\test_batch.bat',
start_date => sysdate,
enabled => true,
comments => 'Run VB Script');
end;
Check if the directory is created and if the file is copied over. Task is to kick off the executable and test is the VBscript within the batch. Challenge is how long the script runs before the next statement in the PL/SQL runs. May be you have to introduce sleep in between.
Note: You must have at least "CREATE JOB" privilege.
Happy coding!
Prakash
Message was edited by:
Prakash Rai -
Unable to call a procedure from inside a another procedure
Dear members
I am trying to call a procedure from inside an another procedure.Both the procedures are present within the same package.I am trying to call the second procedure just before the end of the first procedure.Both the procedures are compiling fine but the tables are not getting populated inside the second procedure.Also the DBMS_OUTPUT statements present in second procedures are not getting displayed.(I feel the second procedured is not getting called).
The package specification is as follows:
CREATE OR REPLACE package ANVESH.conv_api_pkg
is
PROCEDURE PROC_CONVERSION_API(FILE_PATH IN VARCHAR2,FILE_NAME IN VARCHAR2) ;
TYPE cts_order_details IS TABLE OF XXCTS_ORDER_DETAILS_STG%ROWTYPE;
PROCEDURE proc_conversion_api2(p_orderdetails IN cts_order_details) ;
end conv_api_pkg;The package body is as follows:
CREATE OR REPLACE package body ANVESH.conv_api_pkg
is
PROCEDURE PROC_CONVERSION_API(FILE_PATH IN VARCHAR2,FILE_NAME IN VARCHAR2)
IS
v_file_type utl_file.file_type;
v_buffer VARCHAR2(1000);
V_CUSTOMER_NAME VARCHAR2(100);
V_MANUFACTURER VARCHAR2(100);
V_PRODUCT_NAME VARCHAR2(100);
V_QUANTITY NUMBER;
V_REQ_SHIP_DATE DATE;
V_REQ_PRICE NUMBER;
V_LOG_FILE utl_file.file_type;
V_COUNT_CUST NUMBER;
V_COUNT_PROD NUMBER;
L_ORDER_LINES CONV_API_PKG.cts_order_details:=CONV_API_PKG.cts_order_details();
BEGIN
DBMS_OUTPUT.PUT_LINE('Inside begin 1');
v_file_type := UTL_FILE.fopen(FILE_PATH, FILE_NAME, 'r',null);
DBMS_OUTPUT.PUT_LINE('Inside begin 1.1');
LOOP
BEGIN
DBMS_OUTPUT.PUT_LINE('Inside begin 2');
UTL_FILE.GET_LINE (v_file_type,v_buffer);
DBMS_OUTPUT.PUT_LINE('Inside begin 2.1');
DBMS_OUTPUT.PUT_LINE('the buffer is '||v_buffer);
DBMS_OUTPUT.PUT_LINE('the length of buffer is '||length(v_buffer));
V_CUSTOMER_NAME := trim(substr(v_buffer, 1, 30));
DBMS_OUTPUT.PUT_LINE('Customer Name is '||V_CUSTOMER_NAME);
V_MANUFACTURER := trim(substr(v_buffer, 31, 40));
DBMS_OUTPUT.PUT_LINE('Manufacturer is '||V_MANUFACTURER);
V_PRODUCT_NAME := trim(substr(v_buffer, 71, 20));
DBMS_OUTPUT.PUT_LINE('Product Name is '||V_PRODUCT_NAME);
V_QUANTITY := to_number(trim(substr(v_buffer, 91, 5)));
DBMS_OUTPUT.PUT_LINE('Quantity is '||V_QUANTITY);
V_REQ_SHIP_DATE := to_date(trim(substr(v_buffer, 96, 20)), 'DD-MON-YYYY');
DBMS_OUTPUT.PUT_LINE('Requested Ship Date is '|| V_REQ_SHIP_DATE);
V_REQ_PRICE :=nvl(substr( trim(v_buffer), 116, length(v_buffer)-116),0);
--DBMS_OUTPUT.PUT_LINE('Requested Price is1 '||substr(v_buffer, 116, 5));
DBMS_OUTPUT.PUT_LINE('The requested price is '||V_REQ_PRICE);
V_LOG_FILE := UTL_FILE.FOPEN(FILE_PATH, 'LOG_FILE.dat', 'A');
IF (V_QUANTITY > 0)
THEN
DBMS_OUTPUT.PUT_LINE('The quantity is '||V_QUANTITY);
SELECT COUNT (*)
INTO V_COUNT_CUST
FROM CONVERSION_CUSTOMERS
WHERE CUSTOMER_NAME = V_CUSTOMER_NAME;
DBMS_OUTPUT.PUT_LINE('The Customer count is '||V_COUNT_CUST);
IF(V_COUNT_CUST > 0)
THEN
SELECT COUNT(*)
INTO V_COUNT_PROD
FROM conversion_products
WHERE PRODUCT_NAME = V_PRODUCT_NAME;
DBMS_OUTPUT.PUT_LINE('The Product count is '||V_COUNT_PROD);
IF(V_COUNT_PROD >0)
THEN
INSERT INTO XXCTS_ORDER_DETAILS_STG VALUES (V_CUSTOMER_NAME, V_PRODUCT_NAME, V_MANUFACTURER, V_QUANTITY, V_REQ_SHIP_DATE, V_REQ_PRICE, 'ACTIVE', 'ORDER TAKEN');
ELSE
DBMS_OUTPUT.PUT_LINE('PRODUCT SHOULD BE VALID');
UTL_FILE.PUT_LINE(V_LOG_FILE, 'PRODUCT SHOULD BE VALID');
END IF;
ELSE
DBMS_OUTPUT.PUT_LINE('CUSTOMER SHOULD BE VALID');
UTL_FILE.PUT_LINE(V_LOG_FILE, 'CUSTOMER SHOULD BE VALID');
END IF;
ELSE
DBMS_OUTPUT.PUT_LINE('QUANTITY SHOULD BE VALID');
UTL_FILE.PUT_LINE(V_LOG_FILE, 'QUANTITY SHOULD BE VALID');
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
SELECT CUSTOMER_NAME, PRODUCT_NAME, MANUFACTURER, QUANTITY, REQUESTED_SHIP_DATE, REQUESTED_PRICE, STATUS,MESSAGE
BULK COLLECT
INTO L_ORDER_LINES
FROM XXCTS_ORDER_DETAILS_STG;
DBMS_OUTPUT.PUT_LINE('values inserted');
proc_conversion_api2(p_orderdetails=>L_ORDER_LINES);
END;
PROCEDURE proc_conversion_api2(p_orderdetails IN cts_order_details)
IS
V_AVL_QUANTITY CONVERSION_PRODUCTS.AVL_QUANTITY%TYPE;
V_REQ_SHIP_DATE DATE;
V_LIST_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_NET_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_NET CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_EXTN_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_CUST_DISC CONVERSION_CUSTOMERS.DISCOUNT%TYPE;
V_CERT_DISC CONVERSION_CERTIFICATION.DISCOUNT%TYPE;
V_CUST_ID XXCTS_ORDER_DETAILS.CUSTOMER_ID%TYPE;
V_PROD_ID XXCTS_ORDER_DETAILS.PRODUCT_ID%TYPE;
V_DISC_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_DISC_NAME CONVERSION_CERTIFICATION.CERTIFICATION%TYPE;
V_TOTAL_DISC_AMT NUMBER;
V_TOTAL_DISC NUMBER;
V_LIMIT NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE('INSIDE API_2 BEGIN 1');
FOR i IN p_orderdetails.FIRST..p_orderdetails.LAST
LOOP
BEGIN
DBMS_OUTPUT.PUT_LINE('INSIDE API_2 BEGIN 2');
SELECT PRODUCT_ID,AVL_QUANTITY,LIST_PRICE
INTO V_PROD_ID,V_AVL_QUANTITY,V_LIST_PRICE
FROM CONVERSION_PRODUCTS
WHERE PRODUCT_NAME=p_orderdetails(i).PRODUCT_NAME;
DBMS_OUTPUT.PUT_LINE('PRODUCT QUANTITY is '||V_PROD_ID);
DBMS_OUTPUT.PUT_LINE('AVAILABLE QUANTITY is '||V_AVL_QUANTITY);
DBMS_OUTPUT.PUT_LINE('LIST PRICE is '||V_LIST_PRICE);
SELECT CUSTOMER_ID,NVL(DISCOUNT,0)
INTO V_CUST_ID,V_CUST_DISC
FROM CONVERSION_CUSTOMERS
WHERE CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
DBMS_OUTPUT.PUT_LINE('CUSTOMER ID is '||V_CUST_ID);
DBMS_OUTPUT.PUT_LINE('CUSTOMER DISCOUNT IS '||V_CUST_DISC);
SELECT A.DISCOUNT,A.CERTIFICATION
INTO V_CERT_DISC,V_DISC_NAME
FROM CONVERSION_CERTIFICATION A,CONVERSION_CUSTOMERS B
WHERE A.CERTIFICATION=B.CERTIFICATION(+)
AND B.CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
DBMS_OUTPUT.PUT_LINE('CERTIFICATION DISCOUNT IS '||V_CERT_DISC);
V_NET:=((V_LIST_PRICE)-(V_LIST_PRICE)*(V_CERT_DISC)/100);
DBMS_OUTPUT.PUT_LINE('NET PRICE AFTER CERTIFICATION DISCOUNT IS '||V_NET);
V_NET_PRICE:=((V_NET)-(V_NET)*(V_CUST_DISC)/100);
DBMS_OUTPUT.PUT_LINE('NET PRICE AFTER COMPLETE DISCOUNT IS '||V_NET_PRICE);
V_EXTN_PRICE:=(V_NET_PRICE)*(p_orderdetails(i).QUANTITY);
DBMS_OUTPUT.PUT_LINE('EXTENDED PRICE IS '||V_EXTN_PRICE);
V_TOTAL_DISC:=((V_CERT_DISC)/100+(V_CUST_DISC)/100);
DBMS_OUTPUT.PUT_LINE('TOTAL DISCOUNT IS '|| V_TOTAL_DISC);
V_TOTAL_DISC_AMT:=(V_LIST_PRICE)-(V_NET_PRICE);
DBMS_OUTPUT.PUT_LINE('TOTAL DISCOUNT PRICE IS '|| V_TOTAL_DISC_AMT);
SELECT MAX(A.LIMIT)
INTO V_LIMIT
FROM CONVERSION_CERTIFICATION A,CONVERSION_CUSTOMERS B
WHERE A.CERTIFICATION=B.CERTIFICATION(+)
AND B.CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
IF p_orderdetails(i).QUANTITY<V_AVL_QUANTITY THEN
INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'QTY HOLD','REQ QNTY LESS THAN AVL QTY',SYSDATE);
INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
END IF;
IF p_orderdetails(i).REQUESTED_SHIP_DATE<SYSDATE THEN
INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'DATE HOLD','SHIPDATE CANNOT BE LESS THAN CURR DATE',SYSDATE);
INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
END IF;
IF V_NET_PRICE>p_orderdetails(i).REQUESTED_PRICE THEN
INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'PRICE HOLD','NET PRICE CANNOT BE MORE THAN REQ PRICE',SYSDATE);
INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
END IF;
/* IF V_LIMIT<p_orderdetails(i).REQUESTED_PRICE THEN
INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'ORDER LIMIT HOLD','PRICE CANNOT EXCEED ORDER LIMIT',SYSDATE);
INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
END IF;*/
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE(' INSIDE EXCEPTION BLOCK');
END;
END LOOP;
END;
end conv_api_pkg;
/the pl/sql block to invoke the the procedure :
declare
begin
PROC_CONVERSION_API('/usr/tmp' ,'Walmart_Orders_062908.dat');
end;please let me know what is wrong in the program.
Thanks
AnveshHi Walter
Yes 'Inside begin 1' and 'Inside begin 2' were printed.Please find the the DBMS_OUTPUT statements that were printed.
Inside begin 1
Inside begin 1.1
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY SONY ERICSSON W580i 25 1-AUG-2008 50
the length of buffer is 118
Customer Name is BESTBUY
Manufacturer is SONY ERICSSON
Product Name is W580i
Quantity is 25
Requested Ship Date is 01-AUG-08
The requested price is 50
The quantity is 25
The Customer count is 1
The Product count is 0
PRODUCT SHOULD BE VALID
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY SAMSUNG BLACKJACK 50 15-JUL-2008 150
the length of buffer is 119
Customer Name is BESTBUY
Manufacturer is SAMSUNG
Product Name is BLACKJACK
Quantity is 50
Requested Ship Date is 15-JUL-08
The requested price is 150
The quantity is 50
The Customer count is 1
The Product count is 1
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY APPLE IPHONE 4GB 50 15-JUL-2008
the length of buffer is 116
Customer Name is BESTBUY
Manufacturer is APPLE
Product Name is IPHONE 4GB
Quantity is 50
Requested Ship Date is 15-JUL-08
The requested price is 0
The quantity is 50
The Customer count is 1
The Product count is 1
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY ATT TILT 100 15-JUN-2008
the length of buffer is 116
Customer Name is BESTBUY
Manufacturer is ATT
Product Name is TILT
Quantity is 100
Requested Ship Date is 15-JUN-08
The requested price is 0
The quantity is 100
The Customer count is 1
The Product count is 1
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY NOKIA N73 50 15-JUL-2008 200
the length of buffer is 118
Customer Name is BESTBUY
Manufacturer is NOKIA
Product Name is N73
Quantity is 50
Requested Ship Date is 15-JUL-08
The requested price is 20
The quantity is 50
The Customer count is 1
The Product count is 0
PRODUCT SHOULD BE VALID
Inside begin 2In the first procedure I am trying to read the data from a flat file and store it in a table.Here is the sample data from the flat file.
BESTBUY SONY ERICSSON W580i 25 1-AUG-2008 50
BESTBUY SAMSUNG BLACKJACK 50 15-JUL-2008 150
BESTBUY APPLE IPHONE 4GB 50 15-JUL-2008
BESTBUY ATT TILT 100 15-JUN-2008
BESTBUY NOKIA N73 50 15-JUL-2008 200When tried to execute the second procedure independently using the PL/SQL block,the tables in second procedure were populated and the DBMS_Output statements were also displayed.I have made use of the same query in that case
Thanks
Anvesh
Edited by: Anvesh Reddy on Dec 23, 2008 12:40 PM
Maybe you are looking for
-
XSLT Trasnformation (Error message)
Hi, I want to create a xslt transformation for xml. I have a string field where i have included the content of this xml. When i want to call the transformation i get the message error in the debugger. "Bei XML-ABAP Transformation wurde das Element ab
-
Sony Update Engine Failure (error 100)
Hello. I got a message to update my phone software, when I conected my phone to my pc, and after I started the process i got the Sony Update Engine Failure (error 100) message. Now I CAN'T USE MY PHONE. Every time I start it i get the message: the so
-
When is an account subject to licensing?
Scenario: SharePoint Enterprise 2013 On-Premise If the User Profile Service syncs an OU in Active Directory and that OU contains 10 people's accounts - if only 5 of those people in that OU have been granted rights to a SharePoint site collection in t
-
New z77a G45 Motherboard - computer won't start.
Hi everyone, I would appreciate some help, if possible. I've purchased the following:- 1) i7 3770 processor; 2) z77a-g45 motherboard; Installed them just fine (I think?) - first startup I get a 'CPU has changed, update settings' on the BIOS. However,
-
How do i making a JAR file manifest using SJSE8?