Cdaq chassis query for configuration
I am trying to find a way for Labview correctly detect the number of modules in a CDAQ chassis. The code below will create a MAX configuration file and analyzed to find what I need properly. I'm picking up even if you add a module. But if you remove a module or even disconnect the chassis it still gives the maximum number of modules that have been installed, not the current number.
Is there a way to get the MAXIMUM for updating its configuration when appropriate or a way of questioning the chassis directly?
Thank you
Assuming that you use DAQmx, I think this is what you need:
Just go in the table, one at a time and get the info you need from the nodes property.
Tags: NI Software
Similar Questions
-
Physical connections using 4 counters with NI 9411 cDAQ chassis 9178
Hello
Currently I have a NI 9411 module in a 9178 cDAQ chassis. I use 2 meter to read the frequency measures.
The NI 9411 pinout diagram (see pdf file attached to this post), here are the links that I did:
CTR 0 SRC, pin 1 ground COM
DOOR of the CTR 0, pin 2 to the first signal of frequency
CTR 1 CBC, PIN 6 COM/ground
CTR 1 DOOR, pin 01:53 frequency signal
The problem now is that I had like to use meters of 3rd and 4th in my 9178 cDAQ chassis, but I am confused how to wire
frequency signals in 3rd and 4th, because CTR2 GATE is pin 1 and GATE CTR3 is pin 6. Can I change the assignment of pins
to use the other pins in the NI 9411 module for frequency counter measures? I didn't understand how to do this in MAX
Configuration.
Thank you
Anna
Hi EETDer,
Using 'C-Series Signal connections for counters that you found is a good resource. One thing I want to point out, that's a measure of the frequency on a single meter, simply connect the source of the signal up to the door of the RTC. Internally, the module will forward a database internal time appropriate to the source of counters, so DO NOT want to connect the Source CTR to the mass. On your device, you will be just wire each signal to the source of the meter, so only utilizting pines 1,6,3,8 for your 4 frequency measurements.
-
I've been running a cDAQ-9172 for a USB port with an AO 9263 and a DIO 9401 module. Has worked perfectly so far. I've done some development on a new VI and excerpt of operation without connected cDAQ. Now the cDAQ appears in MAX with little red x in all slots. Chassis reset indicates a reset and the indicator LED flashing. Auto Test indicates a successful self-test. The device will appear in the Windows hardware Manager. If I click on one of the modules in MAX, all the menu bar selections are grayed out. It seems that I can have corrupted a configuration somewhere, somewhere. Ideas or an overview of what has happened with my updated chassis in place?
Thanks for all the ideas!
Paul
So, when you reconnect your cDAQ chassis it does not show green in MAX?
If so it could be a corruption of the database, then I suggest following the steps in this KB: http://digital.ni.com/public.nsf/websearch/86256F0E001DA9FF86256FFD005B827C?OpenDocument
Christian
-
By cDAQ chassis module names?
Hi all
is there a way to get the module name based cDAQ chassis?
I'm just checking if two (or more) identical chassis with different modules are connected to my PC.
Example:
Module 1: cDAQ-9174 with Modules 'A', 'B', 'C', emptySlot, in the right order
Module 2: cDAQ-9174 with Modules 'd', 'E', 'emptySlot', 'emptySlot '.
Problem:
The property 'ActiveDev' node, then recovering the ProductType output array of [cDAQ-9174, cDAQ-9174, A, B, C, D, E,.. .and system peripherals]I do not see the modules are plugged into the chassis.
Any help is appreciated!
Thanks in advance
Achim
Hello Achim,
Please see the attachment or the screenshot for the requested features.
The example is a modified version of this example:
Community: Get the cDAQ Types of Module in LabVIEW - National Instruments
https://decibel.NI.com/content/docs/doc-15978If you wanted to say something different, just write me again.
Best regards
Christoph
-
Problems with NI-VISA 5.0.3 detect a 9474 cDAQ chassis and modules via USB
Hello friends.
I'm running Windows 7 x 64, I installed MAX 4.7.4, NI-VISA 5.0.3 and the other software that comes with them.
I have a 9174 cDAQ chassis and 3 modules.
My problem: when I connect the hardware to my PC via the USB port, it presents itself to the MAX, but NI-VISA does not detect sub "USB" (or elsewhere).
Purpose: What I'm trying to do is communicate with the NI 9223 module, using VISA through MATLAB commands. The MATLAB data acquisition Toolbox supports not the NI 9223, so I would try to acquire help from VISA. However, I don't find the VISA of the device address.
I would like to know your opinion on why modules are not displayed in NI-VISA and if my ultimate quest is valid without doing something nasty like writing C++. I have not found a good source for VISA OR orders either, but I'm sure it exists.
Thank you!
Wes
Hey eccentricorbit,
Unfortunately, you can't talk about a module using VISA or cDAQ chassis. Your options are DAQmx and low level of coding (something nasty like C++). If you do not get DAQmx, you can find excellent examples by accessing:
"" "Start menu" National Instruments "NOR-DAQ ' text Code support ' ANSI C examples
I hope this helps!
~ kgarrett
-
is it possible to check progrommatically if cdaq chassis is used
Hi all
IM writing a program who book a cdaq chassis, but I want to know if data acquisition is in use before taking control of it. Is this possible in the code?
Thank you
The purpose of book is to block all communications with the device and let the reserving computer to have full access. I suggest you just cancel when it is not in use, allowing the other connections to support.
Separated from the cDAQ chassis, if you have multiple computers on the same network as I assume you are, you may have published network variables that tell other computers on the network if the chassis is in use. It's pretty much a a work-around to be able to know if the chassis is to apply vs not used regardless of the booking.
-
Name of the table to query for the time window of work
I am trying to build a query for a list of jobs in tide. Anyone know what table is for the time window? Please notify. Thank you.
Hi Warren, according to me, this is the jobdtl table.
jobdtl_fromtm and jobdtl_untiltm
-
An error occurred when querying for the pending operations
Original title: sysprep problem
I have an acer aspire 5738Z, I use windows 7 (64 bit) I try to open sysprep.exe and it does not open, a text box appears saying "an error occurred when querying for the pending operations. What can I do to fix this?Hello
Thanks for posting the request in the Microsoft community forums.
I understand that you receive the error "an error has occurred when querying for outstanding operations" when trying to open sysprep.exe on the computer.You can try the solutions provide and check if it helps solve the issue.
Method 1:
You can scan System File Checker to fix corrupted files.
How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7
http://support.Microsoft.com/kb/929833Method 2:
If the steps above fail then you can try the steps and check.a. run regedit by typing regedit in start search by pressing ENTER.
b navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
Key: RegistrySizeLimit
Type: REG_DWORD
Value: 0xffffff (4294967295)
c. reset.If you need help with Windows, keep us informed. We will be happy to help you.
-
FRM - 40603:Records is no longer reserved for the update. Query for changes
Hi I have a form that has been developing 6i and upgraded to 11g form work well in 6i, but when I try to do the same function in 11g get this error
FRM - 40603:Records is no longer reserved for the update. Query for changes
When I commit this execute_query (for_update); It is the form to clear values when it loads, the error comes when I try to deleteHow can I do this
Action: If you want to change the block, you will need to re - interview.
I use When-Timer-Expired (WTE) trigger
You have a 'relationship' defined between the blocks of your master and detail? If so, simply update your master block and the block of details will automatically be re-interviewed. If you cannot use a relationship, then you can use can create a timer in the trigger that updates the database, then in the trigger When-Timer-Expired (WTE) you can go to the retail block and run a query. For example: / * the sample on change trigger * /.
DECLARE timer_id TIMER; BEGIN ....your code here that performs the update.... /* Now create an instance of a timer */ timer_id := Create_Timer ('upd_detail',1,NO_REPEAT); END;/* Sample Form Level When-Timer-Expired trigger */ DECLARE timer_id TIMER; BEGIN -- Find the timer first timer_id := FIND_TIMER('upd_detail'); IF NOT ID_NULL(timer_id) THEN GO_BLOCK('DETAIL_BLOCK'); Execute_Query; END IF; END;
-
Single SQL query for the analysis of the date of customs declaration under the table of Stock codes
Dear all,
Please tell us a single SQL query for the below,
We have a Table of Stock as shown below,
STOCK_TABLE
ITEM_CODE
(item code)
BAT_NO
(lot no.)
TXN_CODE
(transaction code)
DOC_NO
(number)
BOE_DT
(date of the customs declaration)
I1
B1
I1
I2
I3
B70
I4
B80
I5
B90
T102
1234
JULY 2, 2015
I6
B100
We have to find the date of customs declaration (i.e. the date when the items have come under this particular table) for items that are not attached to any document (that is, who have TXN_CODE, DOC_NO and BOE_DT fields with a NULL value).
For each item in the table of actions, which is not attached to any document, the customs declaration date is calculated as follows.
- If (code section, lot number) combination is present under HISTORY_TABLE, the date of customs declaration will receive the UPDT_DT, the transaction code (TXN_CODE) is an IN or transactions (which can be analyzed from the TRANSACTIONS table).
- If (code section, lot number) combination is NOT currently at the HISTORY_TABLE (or) the transaction code respective to item - batch number combination code is an operation then customs declaration date will be the date of the document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD that contains the element of that particular lot.
- If the case 1 and case 2 fails, our customs declaration date will be the last date of document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD containing that particular item and the BAT_NO in expected results will be that corresponding to this document, as appropriate, to another NULL.
- If the case 1 or case 2 is successful, the value of the last field (in the output expected, shown further below) BATCH_YN will be 'Y', because it fits the lot. Otherwise it will be 'n'.
-
A design of query for the conversion of time difference in days, hours, Minutes
Hi all
A design of query for the conversion of time difference of time in number of days remaining remaining hours minutes and rest in seconds. Made this one till now. Please suggest for all modifications, until now, it seems to work very well, kindly highlight for any anomaly.
WITH DATA (startDAte, EndDate, Datediff) AS (SELECT to_date ('2015-10-01 10:00:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-20-01 03:00:49 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-10-01 10:00','yyyy-dd-mm hh24:mi:ss')-to_date('2015-20-01 03:00','yyyy-dd-mm hh24:mi:ss') FROM dual)
UNION ALL SELECT to_date ('2015-10-01 10:00:39 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-20-01 03:00:40 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-10-01 10:00','yyyy-dd-mm hh24:mi:ss')-to_date('2015-20-01 03:00','yyyy-dd-mm hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 10:30:45 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 11:00:50 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 10:30','yyyy-dd-mm hh24:mi:ss')-to_date ('2015-11-01 11:00 ',' yyyy-mm-dd hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 09:00:50 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 10:00:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 09:00','yyyy-dd-mm hh24:mi:ss')-to_date ('2015-11-01 10:00 ',' yyyy-mm-dd hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 08:30:49 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 09:30:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 08:30','yyyy-dd-mm hh24:mi:ss')-to_date('2015-11-01 09:30','yyyy-dd-mm hh24:mi:ss') FROM dual
)
Select
trunc ((EndDate-StartDate)) days.
trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24) hours)
trunc (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60) Minutes,))
(to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60 - trunc (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60)) * 60 seconds))))
data;
Thanks for the answers in advance.
AHA!
TO_TIMESTAMP expects a string as input, so it first makes an implicit conversion from DATE to a string, in the format of NSL_DATE_FORMAT.
To convert the TIMESTAMP DATE independently NLS_DATE_FORMAT, use
CAST (
AS TIMESTAMP) -
Someone at - it a process of using planning for configurations document, like the old document BR.100?
Ben
Please refer to Note "Generating BR100 referred to report in Oracle 11i, version 12.0 and 12.1 version planning (Doc ID 826324.1)"
It has:
- the hotfix level required
- an instruction step by step (BR100StyledReportDocument.pdf)
- a pattern of predetermined OPE (BR100_Layout.rtf)
The latest documents are included in the attachment 'BR100StyledReport.zip '.
More useful planning references are available in ' Information Center: planning, Oracle E-Business Suite (Doc ID 1551167.2).
Good luck
Larson
-
SQL query for employees, based on a hierarchy of Org
Hi all
I need a query for employee information based on the hierarchy of the Org.
I tried using previous queries in this forum and on the internet, but not closer to.
Here's the requirement:
Level1 Level 2 Level 3 Org Id 81 102 103 104 111 (parent 104) 112 (parent 104) 105 My requirement is to group employees based on level 2, which should include level 3 employees in the respective level2 parent id.
Please suggest.
Query to get hierarchy: SELECT LPAD(' ',10*(LEVEL-1)) || org.name hierarchy,ose.organization_id_parent, org.organization_id FROM hr_all_organization_units org, per_org_structure_elements ose WHERE 1=1 AND org.organization_id = ose.organization_id_child AND ose.org_structure_version_id = 61 --and org.organization_id = 340 START WITH ose.organization_id_parent = 81 CONNECT BY PRIOR ose.organization_id_child = ose.organization_id_parent ORDER SIBLINGS BY org.location_id, ose.organization_id_child Required Columns: SELECT haou.name, papf.EMPLOYEE_NUMBER, papf.full_name FROM per_org_structure_elements ose ,hr_all_organization_units haou ,per_all_assignments_f paaf ,per_all_people_f papf WHERE ose.ORGANIZATION_ID_PARENT = 81 AND ose.ORG_STRUCTURE_VERSION_ID = 61 AND haou.organization_id = ose.organization_id_child --and paaf.organization_id = ose.organization_id_child and papf.person_id = paaf.person_id and paaf.organization_id = haou.organization_id and :P_GIVEN_DATE between papf.effective_start_date and papf.effective_end_date and :P_GIVEN_DATE between paaf.effective_start_date and paaf.effective_end_date
Thank you and best regards,
Afzal.
with
hr_all_organization_units as
(select 81 organization_id, ' name 81', 'loc_1' any double union location_id
Select 102, 'name 102', 'loc_1' from dual union all
Select 103, 'naming 103', 'loc_10' from dual union all.
Select 104, '104 name', 'loc_5' from dual union all
105, select 'name 105', 'loc_3' from dual union all
Select 111, '111 name', 'loc_5' from dual union all
112, select 'name 112', 'loc_7' from dual
),
per_org_structure_elements as
(select org_structure_version_id 61, organization_id_parent 81, 102 organization_id_child of all the double union)
Select 61,81,103 from all the double union
Select 61,81,104 from all the double union
Select 61,81,105 from all the double union
Select 61,104,111 from all the double union
Select double 61,104,112
),
employees as
(select 1 emp_id, name 'emp_1', org_id 111 Union double all the)
Select 2, 'emp_2', 112 double Union all
Select 3, 'emp_3', 112 double Union all
Select option 4, 'emp_4', 111 double Union all
Select 5, 'emp_5', 105 double Union all
Select 6, 'emp_6', 104 double Union all
Select 7, "emp_7", 103 double Union all
Select 8, 'emp_8', 102 double Union all
Select 9, 'emp_9', 81 of the double
)
Select e.name, e.emp_id, o.level_2
e employees
left outer join
(select org.organization_id,regexp_substr(sys_connect_by_path(org.organization_id,'/'). ' / ',' ^ / (\d+)',1,1,'i',1) level_2
of hr_all_organization_units org,.
per_org_structure_elements dare
where ose.org_structure_version_id = 61
and ose.organization_id_child = org.organization_id
Start with ose.organization_id_parent = 81
Connect prior ose.organization_id_child = ose.organization_id_parent
) o
on e.org_id = o.organization_id
order by emp_id
EMP_ID NAME LEVEL_2 1 emp_1 104 2 emp_2 104 3 emp_3 104 4 emp_4 104 5 emp_5 105 6 emp_6 104 7 emp_7 103 8 emp_8 102 9 emp_9 - Concerning
Etbin
-
I got following error when running tests on the Workbench 2.1
[February 19, 2014 16:27:10: TRANSPORT] [0] FRAME: Async command is monitored by the process of STAF 73
[February 19, 2014 16:27:10: FACTORYIMP] SETTING [0]: insert in the container
[February 19, 2014 16:27:10: TESTHASH] [0] INFO: VirtualMachine installation process
[February 19, 2014 16:27:10: VIRTUALMAC] [0] FRAMEWORK: the Setup() method called
[February 19, 2014 16:27:10: STAFBASE] SETTING [0]: command execution STAF: staf VTAF_VM localhost connect password of administrator agent 192.168.8.158 userid: 11:Infocore' 1 q ssl
[February 19, 2014 16:27:10: STAFBASE] [0] FRAME: command execution STAF: staf localhost VTAF_VM getvms anchor 192.168.8.158:administrator
[February 19, 2014 16:27:11: MULTITECH] [0] FRAME: called VTAF::TestLib:Sphere:Lib:STAFSDK:HostSystem:GetAllVMs (HostName = '192.168.8.150' password = 'infocore"username ="root") returned UNDEF
[February 19, 2014 16:27:11: VIRTUALMAC] [0] FRAMEWORK: new creation vaaivm1-150 VM from scratch...
[February 19, 2014 16:27:11: TESTHASH] [0] ERROR: cannot run processSetup for configuration: cannot run createHOMObj for configuration: No. GuestOS appearing in the XML file
[February 19, 2014 16:27:11: TESTHASH] WARN [0]: found objects that need to be cleaned
[February 19, 2014 16:27:11: VIRTUALMAC] [0] INFO: cleaning of the virtual machine: vaaivm1-150
[February 19, 2014 16:27:11: HOSTSYSTEM] [0] FRAME: HostSystem Cleanup() called
[February 19, 2014 16:27:11: HOSTSYSTEM] [0] FRAMEWORK: the location of the swapfile to the directory of the VM on the host 192.168.8.150 restoration VM...
[February 19, 2014 16:27:11: HOSTSYSTEM] SETTING [0]: setting VM Swapfile location to use the directory of the virtual machine
[February 19, 2014 16:27:11: STAFBASE] SETTING [0]: command execution STAF: staf VTAF_Host localhost connect password of administrator agent 192.168.8.158 userid: 11:Infocore' 1 q ssl
[February 19, 2014 16:27:11: STAFBASE] [0] FRAME: command execution STAF: staf localhost VTAF_Host setswapfilelocation anchor 192.168.8.158:administrator host 192.168.8.150
[February 19, 2014 16:27:31: MULTITECH] [0] FRAME: called VTAF::TestLib:Sphere:Lib:STAFSDK:HostSystem:SetSwapFileLocation (HostName = '192.168.8.150' password = 'infocore"username ="root") '1' returned
[February 19, 2014 16:27:31: HOSTSYSTEM] [0] FRAME: destruction of object 192.168.8.150...
[February 19, 2014 16:27:31: LOGMANAGEM] COMMENTS [0]: recovery log file 192.168.8.150 host vmkernel.log
[February 19, 2014 16:27:31: FILEUTILIT] [0] FRAME: PutTmpDirectory - called for destination host localhost
The same problem was sloved.
Re: Hardware Certification-do can not find the storage50info.txt file to...
-
I tried to set the session established the IPs VMs / host / FQDN / VM names
but each time got the error "cannot run processSetup for configuration: cannot run createHOMObj for configuration: no GuestOS section in the XML file.
I changed the names VMS in vCenter for FQDN and it solved the problem.
HISTORY_TABLE
ITEM_CODE | BAT_NO |
TXN_CODE
DOC_NO
UPDT_DT
I1
B1
T1
1234
JANUARY 3, 2015
I1
B20
T20
4567
MARCH 3, 2015
I1
B30
T30
7890
FEBRUARY 5, 2015
I2
B40
T20
1234
JANUARY 1, 2015
TRANSACTION
TXN_CODE | TXN_TYPE |
T1 | IN |
T20 |
OFF
T30
ALL THE
T50
IN
T80
IN
T90
IN
T60
ALL THE
T70
ALL THE
T40
ALL THE
IN_TABLE_HEAD_1
H1_SYS_ID (primary key) | TXN_CODE | DOC_NO |
DOC_DATE
H1ID1
T1
1234
JANUARY 1, 2015
H1ID2
T70
1234
FEBRUARY 1, 2015
IN_TABLE_ITEM_1
I1_SYS_ID |
H1_SYS_ID
(foreign key referencing H1_SYS_ID in IN_TABLE_HEAD_1)
ITEM_CODE
I1ID1
H1ID1
I1
I1ID2
H1ID1
I100
I1ID3
H1ID2
I3
IN_TABLE_BATCH_1
B1_SYS_ID | TXN_CODE DOC_NO (now in IN_TABLE_HEAD_1) | BAT_NO |
B1ID1
T1
1234
B1 / can be empty
B1ID2
T70
1234
B70
IN_TABLE_HEAD_2
H2_SYS_ID (primary key) | TXN_CODE |
DOC_NO
DOC_DATE
H2ID1
T30
4567
FEBRUARY 3, 2015
H2ID2
T60
1234
JANUARY 3, 2015
IN_TABLE_ITEM_2
I2_SYS_ID | H2_SYS_ID (foreign key referencing H2_SYS_ID in IN_TABLE_HEAD_2) | ITEM_CODE |
I2ID1 | H2ID1 |
I1
I2ID2
H2ID1
I200
I2ID3
H2ID2
I2
IN_TABLE_BATCH_2
B2_SYS_ID |
I2_SYS_ID
(foreign key referencing I2_SYS_ID in IN_TABLE_ITEM_2)
BAT_NO
B2ID1
I2ID1
B30 / null
B2ID2
I2ID2
B90
B2ID2
I2ID3
B60
IN_TABLE_HEAD_3
H3_SYS_ID (primary key) | TXN_CODE | DOC_NO | DOC_DATE |
H3ID1 |
T50
1234
JANUARY 2, 2015
H3ID2
T80
1234
JANUARY 3, 2015
H3ID3
T90
1234
JANUARY 4, 2015
H3ID4
T40
1234
AUGUST 5, 2015
IN_TABLE_ITEM_3
I3_SYS_ID |
H3_SYS_ID
(foreign key referencing H3_SYS_ID in IN_TABLE_HEAD_3)
ITEM_CODE
BAT_NO
I3ID1
H31D1
I2
B50
I3ID2
H3ID2
I4
B40
I3ID3
H3ID3
I4
I3ID4
H3ID4
I6
There is no IN_TABLE_BATCH_3
Please find below the expected results.
OUTPUT
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO |
BOE_DT
BATCH_YN
I1
B1
T1
1234
JANUARY 3, 2015
THERE
I1
B30
T30
7890
FEBRUARY 5, 2015
N
I2
B60
T60
1234
JANUARY 3, 2015
N
I3
B70
T70
1234
FEBRUARY 1, 2015
THERE
I4
T90
1234
JANUARY 4, 2015
N
I6
T40
1234
AUGUST 5, 2015
N
Controls database to create the tables above and insert the records.
CREATE TABLE stock_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), boe_dt DATE );
INSERT EN stock_table
VALUES ('I1', 'B1', '', '', '');
INSERT EN stock_table
VALUES ('I1', '', '', '', '');
INSERT IN stock_table
VALUES ('I2', '', '', '', '');
INSERT EN stock_table
VALUES ('I3', 'B70', '', '', '');
INSERT EN stock_table
VALUES ('I4', 'B80', '', '', '');
INSERT EN stock_table
VALUES ('I5', 'B90', 'T102', '1234', '02-JUL-2015');
INSERT EN stock_table
VALUES ('I6', 'B100', '', '', '');
SELECT *
FROM stock_table
CREATE TABLE history_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), updt_dt DATE );
INSERT IN history_table
VALUES ('I1', 'B1', 'T1', '1234', '03-JAN-2015');
INSERT IN history_table
VALUES ('I1', 'B20', 'T20', '4567', '03-MAR-2015');
INSERT IN history_table
VALUES ('I1', 'B30', 'T30', '7890', '05-FEB-2015');
INSERT IN history_table
VALUES ('I2', 'B40', 'T20', '1234', '01-JAN-2015');
SELECT *
FROM history_table
CREATE TABLE transaction1()txn_code VARCHAR()80),txn_type VARCHAR()80));
INSERT INTO transaction1
VALUES ('T1', 'IN');
INSERT INTO transaction1
VALUES ('T20', 'OUT');
INSERT INTO transaction1
VALUES ('T30', 'ALL');
INSERT INTO transaction1
VALUES ('T40', 'ALL');
INSERT INTO transaction1
VALUES ('T50', 'IN');
INSERT INTO transaction1
VALUES ('T60', 'ALL');
INSERT INTO transaction1
VALUES ('T70', 'ALL');
INSERT INTO transaction1
VALUES ('T80', 'IN');
INSERT INTO transaction1
VALUES ('T90', 'IN');
SELECT *
FROM transaction1
CREATE TABLE in_table_head_1()h1_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_2()h2_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_3()h3_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
INSERT IN in_table_head_1
VALUES ('H1ID1', 'T1', '1234', '01-JAN-2015');
INSERT IN in_table_head_1
VALUES ('H1ID2', 'T70', '1234', '01-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID1', 'T30', '4567', '03-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID2', 'T60', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID1', 'T50', '1234', '02-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID2', 'T80', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID3', 'T90', '1234', '05-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID4', 'T40', '1234', '05-AUG-2015');
CREATE TABLE in_table_item_1()i1_sys_id VARCHAR2()80) PRIMARY KEY,
h1_sys_id VARCHAR2 (80) REFERENCES in_table_head_1()h1_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_2()i2_sys_id VARCHAR2()80) PRIMARY KEY,
h2_sys_id VARCHAR2 (80) REFERENCES in_table_head_2()h2_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_3(i3_sys_id VARCHAR2(80) PRIMARY KEY,
h3_sys_id VARCHAR2 (80) REFERENCES in_table_head_3()h3_sys_id),item_code VARCHAR2()80),
bat_no VARCHAR2 (80));
INSERT IN in_table_item_1
VALUES ('I1ID1', 'H1ID1', 'I1');
INSERT IN in_table_item_1
VALUES ('I1ID2', 'H1ID1', 'I100');
INSERT IN in_table_item_1
VALUES ('I1ID3', 'H1ID2', 'I3');
INSERT IN in_table_item_2
VALUES ('I2ID1', 'H2ID1', 'I1');
INSERT IN in_table_item_2
VALUES ('I2ID2', 'H2ID1', 'I200');
INSERT IN in_table_item_2
VALUES ('I2ID3', 'H2ID2', 'I2');
INSERT IN in_table_item_3
VALUES ('I3ID1', 'H3ID1', 'I2','B50');
INSERT IN in_table_item_3
VALUES ('I3ID2', 'H3ID2', 'I4','B40');
INSERT IN in_table_item_3
VALUES ('I3ID3', 'H3ID3', 'I4','');
INSERT IN in_table_item_3
VALUES ('I3ID4', 'H3ID4', 'I6','');
SELECT *
FROM in_table_item_1
SELECT *
FROM in_table_item_2
SELECT *
FROM in_table_item_3
CREATE TABLE in_table_batch_1()b1_sys_id VARCHAR2()80) PRIMARY KEY,
txn_code VARCHAR2 (80), doc_no VARCHAR2 (80), bat_no VARCHAR2 (80));
CREATE TABLE in_table_batch_2()b2_sys_id VARCHAR2()80) PRIMARY KEY,
i2_sys_id VARCHAR2 (80) REFERENCES in_table_item_2()i2_sys_id),bat_no VARCHAR2()80));
INSERT IN in_table_batch_1
VALUES ('B1ID1', 'T1', '1234', 'B1');
INSERT IN in_table_batch_1
VALUES ('B1ID2', 'T70', '1234', 'B70');
INSERT IN in_table_batch_2
VALUES ('B2ID1', 'I2ID1', 'B30');
INSERT IN in_table_batch_2
VALUES ('B2ID2', 'I2ID2', 'B90');
INSERT IN in_table_batch_2
VALUES ('B2ID3', 'I2ID3', 'B60');
Please advise a solution for the same.
Thank you and best regards,
Séverine Suresh
very forced (question subfactoring used to allow easy testing/verification - could work with these test data only)
with
case_1 as
(select s.item_code,
s.bat_no,
h.txn_code,
h.doc_no,
h.updt_dt boe_dt,
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 1' '.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of w_stock_table
where bat_no is null
or txn_code is null
or doc_no is null
or boe_dt is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and s.bat_no = h.bat_no
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
),
case_2 as
(select s.item_code,
NVL (s.bat_no, h.bat_no) bat_no.
NVL (s.txn_code, h.txn_code) txn_code.
NVL (s.doc_no, h.doc_no) doc_no.
NVL (s.boe_dt, h.updt_dt) updt_dt.
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 2'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of case_1
where refers_to is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
and not exists (select null
of case_1
where item_code = h.item_code
and bat_no = h.bat_no
and txn_code = h.txn_code
and doc_no = h.doc_no
and updt_dt = h.updt_dt
)
),
case_31 as
(select s1.item_code,
NVL (S1.bat_no, W1.bat_no) bat_no.
NVL (S1.txn_code, W1.txn_code) txn_code.
NVL (S1.doc_no, W1.doc_no) doc_no.
NVL (S1.updt_dt, W1.doc_dt) updt_dt.
cases where s1.bat_no = w1.bat_no then 'Y' else ' n end batch_yn.
cases where w1.txn_code is not null
and w1.doc_no is not null
and w1.doc_dt is not null
then "case 31'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s1
left outer join
(select i1.item_code, h1.txn_code, h1.doc_no, h1.doc_dt, b1.bat_no
of w_in_table_item_1 i1
inner join
w_in_table_head_1 h1
On i1.h1_sys_id = h1.h1_sys_id
inner join
w_in_table_batch_1 b1
On h1.txn_code = b1.txn_code
and h1.doc_no = b1.doc_no
) w1
On s1.item_code = w1.item_code
),
case_32 as
(select s2.item_code,
NVL (S2.bat_no, W2.bat_no) bat_no.
NVL (S2.txn_code, W2.txn_code) txn_code.
NVL (S2.doc_no, W2.doc_no) doc_no.
NVL (S2.updt_dt, W2.doc_dt) updt_dt.
cases where s2.bat_no = w2.bat_no then 'Y' else ' n end batch_yn.
cases where w2.txn_code is not null
and w2.doc_no is not null
and w2.doc_dt is not null
then "case 32'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s2
left outer join
(select i2.item_code, h2.txn_code, h2.doc_no, h2.doc_dt, b2.bat_no
of w_in_table_item_2 i2
inner join
w_in_table_head_2 h2
On i2.h2_sys_id = h2.h2_sys_id
inner join
w_in_table_batch_2 b2
On i2.i2_sys_id = b2.i2_sys_id
) w2
On s2.item_code = w2.item_code
),
case_33 as
(select s3.item_code,
w3.bat_no,
NVL (S3.txn_code, w3.txn_code) txn_code.
NVL (S3.doc_no, w3.doc_no) doc_no.
NVL (S3.updt_dt, w3.doc_dt) updt_dt.
cases where s3.bat_no = w3.bat_no then 'Y' else ' n end batch_yn.
cases where w3.txn_code is not null
and w3.doc_no is not null
and w3.doc_dt is not null
then "case 33'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s3
left outer join
(select i3.item_code, h3.txn_code, h3.doc_no, h3.doc_dt, i3.bat_no
of w_in_table_item_3 i3
inner join
w_in_table_head_3 h3
On i3.h3_sys_id = h3.h3_sys_id
) w3
On s3.item_code = w3.item_code
)
Select item_code, bat_no, txn_code, doc_no, boe_dt, batch_yn
of case_1
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_2
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn,
ROW_NUMBER() over (partition by item_code of updt_dt desc order) rn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_31
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_32
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_33
where refers_to is not null
)
)
where rn = 1
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO | BOE_DT | BATCH_YN |
---|---|---|---|---|---|
I1 | B1 | T1 | 1234 | JANUARY 3, 2015 | THERE |
I1 | B30 | T30 | 7890 | FEBRUARY 5, 2015 | N |
I2 | B60 | T60 | 1234 | JANUARY 3, 2015 | N |
I3 | B70 | T70 | 1234 | FEBRUARY 1, 2015 | THERE |
I4 | - | T90 | 1234 | JANUARY 5, 2015 | N |
I6 | - | T40 | 1234 | AUGUST 5, 2015 | N |
Concerning
Etbin
Maybe you are looking for
-
Return to the display of the old images
I've just updated to Firefox 11 and the new view of the image is horrible. When I go to a URL of the image (like this http://www.google.com.br/images/srpr/logo3w.png ), it is displayed with a dark background. It would be best that the background was
-
Re: Satellite L500-1XJ - changed keyboard
Bought a Satellite L500 - 1XJ 32-bit with Windows 7 second hand from a friend.It worked perfectly until the Toshiba files were accidentally deleted.Cannot find it anywhere, so I guess they have been permanently deleted. I tried the restore without su
-
do you need your router firewall
Do you need the firewall on the router.
-
Catch the event CLOSE LabWindows/CVI
In my LabWindows UI, the user can right-click the X in the upper corner to exit the application. I want to intercept this message to do different things before he gets to the TestStand engine. I tried to use InstallWinMsgCallback for a WM_QUIT and WM
-
Skipton was booked for three nights on October 16 to 18. A double and a single.Windermere displayed October 21-24 three nights. A double a single for Mr. and Mrs. Andrews. I made the reservations around January February this year. Thankl help you you