End Loop when value is not in Table
My tables:
Possible_Ids
2222
1111
3333
4444
Used_Ids
5555
6666
2222
7777
Code so far:
declare
type array_type is table of Possible_ids%rowtype;
id_array array_type;
v_id char(4);
v_counter number:=1;
v_found number:=0;
begin
select * bulk collect into id_array from Possible_ids;
loop
if id_array(v_counter).co1 IN Used_ids table* then <--- I need help here,
v_counter:= v_counter+1;
else
v_found:= 1;
v_id:= id_array(v_counter).co1
end if;
exit when v_found = 1;
end loop;
dbms_output.put_line(v_id);
end;
Help: I need to somehow write a statement to instruct the code to "stop" when a value is NOT found in a table. From my tables, the first valid Possible_id would be '1111' since '2222' is already used.
Edited by: Ludovick on Nov 2, 2010 10:25 AM
Edited by: Ludovick on Nov 2, 2010 10:28 AM
Edited by: Ludovick on Nov 2, 2010 10:29 AM
Why so complicated. If you simply want to retrieve the lowest possible id that is not used you could do it like this.
(I assume, your id column in both tables is named ID):
declare
v_id number;
begin
select min(id)
into v_id
from possible_ids
where ID not in (select ID from used_ids);
dbms_output.put_line('found id='||v_id);
exception
when no_data_found then
dbms_output.put_line('no data found'); -- or whatever you want.
end;If you don't need pl/sql you can do it with sql:
select min(id)
from possible_ids
where ID not in (select ID from used_ids);
Similar Messages
-
Hii ..
need help on this ..
This what I am doing ..
I am using a DATAEXPORT function to export level0 data from my essbase 11.1.2.2 to Microsoft SQL 2008 tables.
So what I did first I exported the level0 data to a flat file using DATAEXPORT and the created the SQL columns by the same in that order only in my SQL table.
When I run it fails with this error:
ODBC Layer Error: [21S01] ==> [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021014)
ODBC Layer Error: Native Error code [213]
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Error(1012085)
Unable to export data to SQL table [dataexp]. Check the Essbase server log and the system console to determine the cause of the problem.
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021002)
SQL Connection is Freed
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Warning(1080014)
Transaction [ 0x1c50001( 0x51ee7d66.0x80342 ) ] aborted due to status [1012085].
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1012579)
Total Calc Elapsed Time for [test.csc] : [1.44] seconds
=============================================================
I did a simple test on my Sample.basic application then ..
loaded the calc data to it and then used the below script to export to a flat file
//ESS_LOCALE English_UnitedStates.Latin1@Binary
SET DATAEXPORTOPTIONS
DataExportLevel "Level0";
DataExportOverwriteFile ON;
DataExportColFormat OFF;
DataExportDimHeader OFF;
FIX(
"Jan",
"Sales",
"Actual"
/*DATAEXPORT "File" "," "/home/hypadmin/samtest.txt";*/
DATAEXPORT "DSN" "Abhitest" "sample" "sa" "welcome1";
ENDFIX
out put as below:
"Sales"
"100-30","California"
"Jan","Actual",145
Now In sql I created only 3 columns with name Jan/Sales/Actual and when I run this script again with comments removed .. I get the same error as what I have got in my first test case with other application ..
but when I create the columns with same name as what its in export
Sales/100-30/Califirnia/Jan/Actual
It created the new rows successfully ..
So with this I think the error which I am getting with my other application might be because of the same column issue .. but then I have created all the columns by looking at the export file only as I did in sample ..
Any idea would be helpful ..
Thanks
Abhishek
IFirst make sure you add
DataExportRelationalFile ON;
to your set commands it is missing
I alwats like to also add
DataExportColHeader dimensionName;
so I am sure what dimension is getting put into the columns.
Then count the number of dimensions in your outline (exclude attribute dimensions). You need at least that many columns in your table -1 + the number of members you will be returning as columns in the export
Taking your example Sample basic has 5 dimensions
Measures
Years
Scenario
Product
Market
Since you did not specify a dataexportcolheader it took the dense dimension Scenario as the columns. Your fix statement is limiting that to one member. Doing the math
5 -1 + 1 = 5 columns in your table which is what you found works. Suppose you fixed on bothe Actual and budget in scenario then you would need 6 columns 5 -1 +2 -
Column name or number of supplied values does not match table definition
Buongiorno a tutti,
sto cercando di inserire dei record in un database SQL, usando l'oggetto DB tools Insert data. Purtroppo però mi viene segnalato il seguente errore:
"Exception occured in Microsoft OLE DB Provider for SQL Server: Column name or number of supplied values does not match table definition. in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlibB Tools Insert Data.vi"
Il recod viene generato da Labivew usando l'oggetto concatanate string e i campi sono separati da tab. se esporto su Excel sembra tutto corretto e non ho errori. Le colonne del mio database corrispondono a quelle del record e sono tutte varchar. Vi allego la porzione di codice che genera il record.
Suggerimenti?
Grazie,
Davide
Allegati:
db.png 5 KBPer qualche strano motivo l'editor ha convertuito la sequenza di caratteri ":" e "D" in uno smile
-
How to end loop when desired value is found.
Hi I have a loop below and I want the loop to end when the desired value is found.
<?php do { ?>
<?php $allvotedid = $row_VotedUsers['VotedID'] ?>
<?php } while ($row_VotedUsers = mysql_fetch_assoc($VotedUsers)); ?>
I want this loop to end when $row_VotedUsers['VotedID'] equals the URL variable ID. So lets say pagename.php?ID=1, I want the loop to go until it finds a value equal to ID which is 1. And then I want it to assign that value to $allvotedid. And if finds no value equal to it then I want it to stop looping.
Thanks for any help. I hope I made this clear.cwhazzoo wrote:
Hi I have a loop below and I want the loop to end when the desired value is found.
The following will do what you have asked for:
<?php do { ?>
<?php
if (isset($_GET['ID']) && $_GET['ID'] == $row_VotedUsers['VotedID']) {
$allvotedid = $row_VotedUsers['VotedID'];
break;
} ?>
<?php } while ($row_VotedUsers = mysql_fetch_assoc($VotedUsers)); ?>
However, it's a very inefficient way of doing it. If what you're interested in is whether the ID passed through the URL is in the VotedID column, just create a recordset using the URL parameter ID ($_GET['ID']) as the filter. Then check the value of $totalRows_VotedUsers. If it's 1, the user has voted. If it's 0, the user hasn't voted. -
Insert Error: Column name or number of supplied values does not match table definition.
I'm getting this error when I try to run my stored procedure, I have checked that the inserts matches the select, which seemed to be
the issue for most of the time this question is asked. As far as I can tell they match so something else must be wrong.
Code:-
CREATE proc [dbo].[prc_ITEM_master_Customer]
as
begin
set nocount on
/****** Object: Table [dbo].[tempdb..tmpWebCustomers] Script Date: 03/05/2014 20:49:28 ******/
IF EXISTS (SELECT * FROM tempdb.sys.objects WHERE name = 'tmpWebCustomers' AND type in (N'U'))
DROP TABLE tempdb..tmpWebCustomers
CREATE TABLE tempdb..tmpWebCustomers
[Customer Number] varchar(6),
[Store Number] varchar(6),
[Company Name] varchar(35),
[Email Address] varchar(75),
[Password] varchar(20),
[Contact Name] varchar(20),
[Phone] varchar(20),
[Billing Address] varchar(40),
[Billing City] varchar(30),
[Billing State] varchar(2),
[Billing Zip] varchar(10),
[Billing Country] varchar(15),
[Shipping Address] varchar(40),
[Shipping City] varchar(30),
[Shipping State] varchar(2),
[Shipping Zip] varchar(10),
[Shipping Country] varchar(15),
[Payment Terms] varchar(1),
[Prepaid Freight Amount] decimal(14,4),
[Is Preferred] bit,
[Fuel Surcharge Exempt] bit,
[Sales Tax Addback] bit,
[Broken Box Exempt] bit,
[Canada Freight Exempt] bit,
[Furniture Handling Exempt] bit,
[Create At] datetime,
[Updated At] datetime,
[Sales Rep] varchar(50),
[Sales Rep Phone] varchar(15),
[Sales Rep Email] varchar(50),
[Inside Rep] varchar(50),
[Inside Rep Email] varchar(50),
[Parent] bit
--Insert All Non-National Account Customers--
INSERT INTO tempdb..tmpWebCustomers
SELECT
C.CUSTNO as 'Customer Number',
'' as 'Store Number',
C.COMPANY as 'Company Name',
RTRIM(C.EMAIL) as 'Email Address',
C.MISC6 as 'Password',
C.CONTACT as 'Contact Name',
C.PHONE as 'Phone',
C.ADDRESS1 as 'Billing Address',
C.CITY as 'Billing City',
C.STATE as 'Billing State',
C.ZIP as 'Billing Zip',
C.COUNTRY as 'Billing Country',
'' as 'Shipping Address',
'' as 'Shipping City',
'' as 'Shipping State',
'' as 'Shipping Zip',
'' as 'Shipping Country',
CASE
WHEN C.PTERMS='CREDIT CARD' THEN 1
WHEN C.PTERMS='CREDIT CART ONLY' THEN 1
WHEN C.PNET=0 THEN 0
ELSE 2
END as 'Payment Terms',
C.PPFREIGHT as 'Prepaid Freight Amount',
C.PRPRICE as 'Is Preferred',
C.FSEXEMPT as 'Fuel Surcharge Exempt',
C.STADDBACK as 'Sales Tax Addback',
C.BROKEN as 'Boken Box Exempt',
C.CANADAFREIGHT as 'Canada Freight Exempt',
C.FHEXEMPT as 'Furniture Handling Exempt',
C.ADDDATE as 'Created At',
C.LCKDATE as 'Updated At',
RTRIM(R.SFIRST) +' '+ RTRIM(R.SLAST) as 'Sales Rep',
R.PHONE as 'Sales Rep Phone',
CASE
WHEN R.EMAIL='[email protected]' then ''
ELSE R.EMAIL
END as 'Sales Rep Email',
RTRIM(I.SFIRST) +' '+ RTRIM(I.SLAST) as 'Inside Rep',
I.EMAIL as 'Inside Rep Email',
0
FROM tblARCUST C
INNER JOIN tblICSLSP R ON C.SALESMN=R.SLSMN
LEFT OUTER JOIN tblICSLSP I ON R.INSIDESALES=I.SLSMN
WHERE
C.NATION=0
AND C.ACTIVE=1
AND C.MISC6 !=''
AND C.EMAIL like '%@%'
--Populate Shipping Address Data--
UPDATE tempdb..tmpWebCustomers
SET
[Shipping Address]=RTRIM(S.ADDRESS1),
[Shipping City]=RTRIM(S.CITY),
[Shipping State]=RTRIM(S.STATE),
[Shipping Zip]=RTRIM(S.ZIP),
[Shipping Country]=RTRIM(S.COUNTRY)
from tempdb..tmpWebCustomers W
INNER JOIN tblARCADR S ON W.[Customer Number]=S.CUSTNO
WHERE S.DEFASHIP='Y'
UPDATE tempdb..tmpWebCustomers
SET
[Shipping Address]=[Billing Address],
[Shipping City]=[Billing City],
[Shipping State]=[Billing State],
[Shipping Zip]=[Billing Zip],
[Shipping Country]=[Billing Country]
WHERE
[Shipping Address]=''
--Insert National Account Customers
INSERT INTO tempdb..tmpWebCustomers
SELECT
C.CUSTNO as 'Customer Number',
S.CSHIPNO as 'Store Number',
S.COMPANY as 'Company Name',
RTRIM(S.EMAIL) as 'Email Address',
S.MISC6 as 'Password',
S.CONTACT as 'Contact Name',
S.PHONE as 'Phone',
C.ADDRESS1 as 'Billing Address',
C.CITY as 'Billing City',
C.STATE as 'Billing State',
C.ZIP as 'Billing Zip',
C.COUNTRY as 'Billing Country',
S.ADDRESS1 as 'Shipping Address',
S.CITY as 'Shipping City',
S.STATE as 'Shipping State',
S.ZIP as 'Shipping Zip',
S.COUNTRY as 'Shipping Country',
CASE
WHEN C.PTERMS='CREDIT CARD' THEN 1
WHEN C.PTERMS='CREDIT CART ONLY' THEN 1
WHEN C.PNET=0 THEN 0
ELSE 2
END as 'Payment Terms',
C.PPFREIGHT as 'Prepaid Freight Amount',
C.PRPRICE as 'Is Preferred',
C.FSEXEMPT as 'Fuel Surcharge Exempt',
C.STADDBACK as 'Sales Tax Addback',
C.BROKEN as 'Boken Box Exempt',
C.CANADAFREIGHT as 'Canada Freight Exempt',
C.FHEXEMPT as 'Furniture Handling Exempt',
S.ADDDATE as 'Created At',
S.LCKDATE as 'Updated At',
RTRIM(R.SFIRST) +' '+ RTRIM(R.SLAST) as 'Sales Rep',
R.PHONE as 'Sales Rep Phone',
CASE
WHEN R.EMAIL='[email protected]' then ''
ELSE R.EMAIL
END as 'Sales Rep Email',
RTRIM(I.SFIRST) +' '+ RTRIM(I.SLAST) as 'Inside Rep',
I.EMAIL as 'Inside Rep Email',
0
FROM tblARCUST C
INNER JOIN tblARCADR S ON C.CUSTNO=S.CUSTNO
INNER JOIN tblICSLSP R ON C.SALESMN=R.SLSMN
LEFT OUTER JOIN tblICSLSP I ON R.INSIDESALES=I.SLSMN
WHERE
C.NATION=1
AND C.ACTIVE=1
AND S.MISC6 !=''
AND S.EMAIL LIKE '%@%'
--Insert National Account Parents
INSERT INTO tempdb..tmpWebCustomers
SELECT
C.CUSTNO as 'Customer Number',
'' as 'Store Number',
C.COMPANY as 'Company Name',
RTRIM(C.EMAIL) as 'Email Address',
C.MISC6 as 'Password',
C.CONTACT as 'Contact Name',
C.PHONE as 'Phone',
C.ADDRESS1 as 'Billing Address',
C.CITY as 'Billing City',
C.STATE as 'Billing State',
C.ZIP as 'Billing Zip',
C.COUNTRY as 'Billing Country',
C.ADDRESS1 as 'Shipping Address',
C.CITY as 'Shipping City',
C.STATE as 'Shipping State',
C.ZIP as 'Shipping Zip',
C.COUNTRY as 'Shipping Country',
CASE
WHEN C.PTERMS='CREDIT CARD' THEN 1
WHEN C.PTERMS='CREDIT CART ONLY' THEN 1
WHEN C.PNET=0 THEN 0
ELSE 2
END as 'Payment Terms',
C.PPFREIGHT as 'Prepaid Freight Amount',
C.PRPRICE as 'Is Preferred',
C.FSEXEMPT as 'Fuel Surcharge Exempt',
C.STADDBACK as 'Sales Tax Addback',
C.BROKEN as 'Boken Box Exempt',
C.CANADAFREIGHT as 'Canada Freight Exempt',
C.FHEXEMPT as 'Furniture Handling Exempt',
C.ADDDATE as 'Created At',
C.LCKDATE as 'Updated At',
RTRIM(R.SFIRST) +' '+ RTRIM(R.SLAST) as 'Sales Rep',
R.PHONE as 'Sales Rep Phone',
CASE
WHEN R.EMAIL='[email protected]' then ''
ELSE R.EMAIL
END as 'Sales Rep Email',
RTRIM(I.SFIRST) +' '+ RTRIM(I.SLAST) as 'Inside Rep',
I.EMAIL as 'Inside Rep Email',
1
FROM tblARCUST C
INNER JOIN tblICSLSP R ON C.SALESMN=R.SLSMN
LEFT OUTER JOIN tblICSLSP I ON R.INSIDESALES=I.SLSMN
WHERE
C.NATION=1
AND C.ACTIVE=1
AND C.MISC6 !=''
AND C.EMAIL like '%@%'
end
GOCant spot anything obvious
Are you sure you're running this in a new window? Make sure there's not any other bits of code present in window where you're running this.
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
/*FIRST TABLE*/
create table Employee1(
empid int,
empname varchar(20),
salary int,
gender varchar(10),
depid int)
insert into Employee1 values(1,'jitendra',500000,'m',100)
/*2 ND TABLE*/
create table audit(
empid int,
auditdata varchar(50))
NOW I AM APPLYING TRIGGER
/* triggers demo for after insert*/
alter trigger tr_employee1_insert
on Employee1 for insert
as begin
declare @id int
select @id=empid from inserted
insert into audit values ('new employee is inserted with id=' + CAST(@id as nvarchar(5))+'is added at'+CAST(GETDATE() as nvarchar(20)))
end
insert into employee1 values (9,'shubham',110000,'m',200)
PLEASE HELP ME TO SOLVEdeclare @id int
select @id=empid from inserted
insert into audit values ('new employee is inserted with id=' + CAST(@id as nvarchar(5))+'is added at'+CAST(GETDATE() as nvarchar(20)))
This code will not properly handle a multi-row insert. I suggest an approach like the example below instead of scalar variables. Also, I suggest you just store the normalized data in the audit table (id, action, timestamp) instead of the
formatted string. That will facilitate subsequent queries and reporting on the data.
ALTER TRIGGER tr_employee1_insert
ON dbo.Employee1 FOR INSERT
AS
INSERT INTO dbo.audit (empid, auditdata)
SELECT
id
, 'new employee is inserted with id=' + CAST(id as nvarchar(5)) + 'is added at ' + CAST(GETDATE() as nvarchar(20))
FROM inserted;
GO
Dan Guzman, SQL Server MVP, http://www.dbdelta.com -
When inserting inline notes within tables the focus shifts to the top of galley view
There is a latency between each letter typed while the focus switches between the top of galley view and back to the note insertion point. I heard this was a known error in a previous version of InCopy but all users are now running v7.5.2. Does anyone know of a workaround or resolution?
Oclair wrote:
post.user_wrote.label:
I can't figure out what you are describing. Maybe that's why it is unanswered.
1) The only thing that changes the focus is my mouse and arrow keys.
2) What's a "Finder-based selection window?"
3) Mine selects the next item in the list, which I expect. If I'm going down a list of items deciding which to delete, I'd like it to move to the next item.
If you want the choice of some other behavior, send feedback to Apple. I doubt they will provide any choices as that is not in their nature.
>If you want the choice of some other behavior, send feedback to Apple.
The original behavior. Q: what should I tell them? A: If you add new behaviors add a preference for it.
>Mine selects the next item in the list, which I expect. If I'm going down a list of items deciding which to delete, I'd like it to move to the next item.
That's Insane, it sounds to me like
Maybe my Mac can have sex with my wife which I expect?
#EasyModeOff
Sorry. Still have no idea what you are talking about. I have no idea what the new behavior is. As far as I can tell, the Finder works as it always has.
Now, if you jumped from Leopard or Snow Leopard to Yosemite, I can't remember that far back as to any behavior such as you describe.
I don't know what you should tell them to do as I have no idea what is the behavior you expect.
Perhaps your wife would be happier. -
Music plays upon ending call when music app not currently being used.
iPhone 5, with iOS 7.0.4. Randomly, when i hang up from a call, the Music app starts playing the song that I was listening to last. However, sometimes it has been a day or more since i was listening to the song. Very Annoying. What is Apples fix for this??
Same thing happens on an iPhone 6 running IOS 8.0.2, but only when using Bluetooth headset. Very irritating.
-
htmlb:tableView : (table) Attribute value is not a valid reference
Hi All,
In Table view i am getting the following error.
The following error text was processed in the system:
<htmlb:tableView>: (table) Attribute value is not a table
My code in View is
CREATE OBJECT MODEL TYPE ZCL_HREPAN_MODEL_MAIN.
CREATE OBJECT tv_itr1 TYPE ZCL_HREPAN_MODEL_ITR_STATUS exporting model = model.
%>
<htmlb:tableView id = "reportsTable1"
headerVisible = "true"
headerText = "All PANs:"
footerVisible = "true"
design = "alternating"
visibleRowCount = "20"
width = "100%"
fillUpEmptyRows = "false"
columnWrapping = "false"
columnWidth = "200"
sort = "server"
selectionMode = "lineEdit"
iterator = "<%=tv_itr1%>"
table = "//MODEL/DATE_RANGE_PAN" >
</htmlb:tableView>
in above DATE_RANGE_PAN is table from model 'ZCL_HREPAN_MODEL_MAIN'
Controller as below: DO_REQUEST.
if lr_event is bound and lr_event->server_event = 'allpans'.
lo_model ?= get_model( 'model_id_status' ).
lo_display_view->set_attribute( name = 'model' value = lo_model ).
lo_display_view = create_view( view_name = 'allpans.htm').
call_view( lo_display_view ).
ENDIF.
DO_INIT as below
lo_model ?= create_model( class_name = 'ZCL_HREPAN_MODEL_MAIN'
model_id = 'model_id_status').
please help me how to solve this??
REgards,
KishanI think DATE_RANGE_PAN is not table. Make sure its a table. If issue persist, post the data type declaration here.
Raja -
Row Insert Failed - Column name or number of supplied values does not match
Hi ,
I am trying add a new field to an existing table in MSSQL and access it in portlets,
I added the new field in the table, and making necessary updations to the accessing java code seems to look fine. but when i insert the new rwo, fails with exception listed below.
My code tidbits is as follows.
System.out.println("Column Location of outsidePhysician"+ aResultSet.findColumn("outsidePhysician")); // works and returns 24
if (anIntake.getOutsidePhysician() != null && !(anIntake.getOutsidePhysician().equals("")))
System.out.println("Now Alternate Physician will be added to resultset");
aResultSet.updateString(24, anIntake.getOutsidePhysician());
aResultSet.updateString("outsidePhysician",anIntake.getOutsidePhysician());
System.out.println("Now Alternate Physician already added to resultset"); // also printed
}else{
aResultSet.updateString(24, "new Physician");
aResultSet.updateString("outsidePhysician","new Physician");
//NOT NULL
aResultSet.insertRow(); // fails here
System.out.println("Inserted");
The table has the right field name too, which is proved when i retrieve the fieldno, based on field name. I tried to delete the field and removing these changes work ok..
Any ideas would be of help
Thanks in Advance
Usha
[Microsoft][SQLServer 2000 Driver for JDBC]Row insert failed. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.base.BaseImplUpdatableResultSet.executeStatement(Unknown Source) at com.microsoft.jdbc.base.BaseImplUpdatableResultSet.insertRow(Unknown Source) at com.microsoft.jdbc.base.BaseResultSet.insertRow(Unknown Source) at com.microsoft.jdbcx.base.BaseResultSetWrapper.insertRow(Unknown Source) at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.insertRow(WSJdbcResultSet.java:2181) ... 14 more Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Insert Error: Column name or number of supplied values does not match table definition. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExceI haven't ever used that method of inserting rows, but from the example in the API documentation it looks to me like you have to callaResultSet.moveToInsertRow();before you callaResultSet.insertRow();Or are you just "inserting" the physician's name into existing rows of the database? If that's what you are doing then you need to callaResultSet.updateRow();Message was edited by:
DrClap -
Loop not working for check of duplicate values in a repeating table
I have a form that is used for marking down problem items, describing the problems and assigning a value to the specified item. In some cases the problems belong to the same class. When they do, the value associated with the problem should only be marked once. If another problem in the same class is documented the value should not be recorded the second time. I have a variable that is called based on a switch statement in the exit event of the field that records the problem item number. The script in the variable is then supposed to check for duplicate values in the table. If no other problem item in that class is selected, then the problem value should be assigned a number. If another item from the same class has already been entered, then the problem value should just be left blank. I will paste the script for the variable below as well as the switch statement. When I used to call the variable based upon the change event for the problem item, the script work. At that time, the switch statement was related to a drop-down menu. We decided to get rid of the drop-down and just have the used type the item number. But to do so, I had to move the switch statement to the exit event for the field. when I did this, the script in the variable no longer worked properly. Here is the switch statment followed by the script in the variable:
this.rawValue = this.rawValue.toLowerCase();
var bEnableTextField = true;
var i = "Inspection Criteria: ";
var r = "Required Corrections: ";
switch (this.rawValue)
case "1a": // 1a- First debit option
CorrectionsText.CorrectionLang = r+"Correction description for 1st debit";
ViolCorrSection.ViolationsText.DebitVal = "C";
ViolCorrSection.Reference.RefLanguage = i+"1st debit reference";
break;
case "1b": // 1b- Second debit option
CorrectionsText.CorrectionLang = r+"Correction description for 2nd debit";
ViolCorrSection.Reference.RefLanguage = i+"2nd debit reference";
myScript.group1();
break; //the script continues for various item numbers...
________________ variable script ________________________
function group1()
//Used in checking duplication of violations
var oFields = xfa.resolveNodes("form1.MAINBODYSUB.ViolationsTableSubform.ViolationsTable.ViolCorrSectio n[*].ViolationsText.ItemNo"); // looks to resolve the repeating rows
var nNodesLength = oFields.length; //assigns the number of rows to a variable
var currentRow = xfa.resolveNode("form1.MAINBODYSUB.ViolationsTableSubform.ViolationsTable.ViolCorrSection ").index;
var currentDebit = xfa.resolveNode("form1.MAINBODYSUB.ViolationsTableSubform.ViolationsTable.ViolCorrSection [" + currentRow + "].ViolationsText.DebitVal");
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) // this loops through Item Numbers looking for duplicate violations
//console.println("nNodeCount: " + nNodeCount);
var nFld = xfa.resolveNode("form1.MAINBODYSUB.ViolationsTableSubform.ViolationsTable.ViolCorrSection [" + nNodeCount + "]");
//console.println("nFld.ViolationsText.ItemNo: " + nFld.ViolationsText.ItemNo.rawValue);
if (nFld.ViolationsText.ItemNo.rawValue == "1a" || nFld.ViolationsText.ItemNo.rawValue == "1b" || nFld.ViolationsText.ItemNo.rawValue == "1c" || nFld.ViolationsText.ItemNo.rawValue == "1d") // looks for other 1s
currentDebit.rawValue = "";
nNodeCount = nNodesLength; // stop loop
else
currentDebit.rawValue = "5";
So, if you enter 1b the first time, you should get a value of 5 appearing in the debit value field. If you enter 1c next, because it belongs to the same group of class of problem items, there should be no value assigned. What happens now is that the values for 1b and 1c don't appear at all because the form thinks that the first 1b entry already existed.
Any ideas? I have a stripped down version of the form that I can email to someone for reference if that would help. Thanks
P.S. I am working with LiveCycle Designer ES 8.2.1....Hi,
I can have a look at your form, but can you host it somewhere like Acrobat.com or google docs and add a link to it here.
Regards
Bruce -
Hello Everyone,
How to update zero to a column value when record does not exist in table but should display the column value when it exists in table
Regards
Regards Gautam SAs per my understanding...
You Would like to see this
Code:
SELECT COALESCE(Salary,0) from Employee;
Regards
Shivaprasad S
Please mark as answer if helpful
Shiv -
Purchased a song on I-tunes....won't let me listen to it...says my computer is not authorized...first time in 3 years that this problem occured ...I went to STORE/AUTHORIZE ,,,and it says my computer is already authorized....never-ending loop ...HELP ! Won't play on Ipod either
Delete and redownload it if doing so is free in your country.
(88542) -
I am trying to put my ical on icloud on my mac and iphone4s but the alternative locations menu only shows Mobileme as a selection choice, not iCloud. I have updated all software on computer. How do I get iCloud sync when iCal will not give it as a choice?
You need to be running OS X 10.7.2 or later. Your signature states you are running 10.6.8
You can buy OS X Mountain Lion 10.8.1 from the Mac AppStore. -
Values r not fetch in internal table
Hi Frds
In my report the values are not fetching in the internal table ICOSP
This is my program ,kindly correct my mistake.
DATA : WBS LIKE VBAK-PS_PSP_PNR.
SELECTION-SCREEN: BEGIN OF BLOCK 01.
SELECTION-SCREEN: BEGIN OF BLOCK 02 WITH FRAME .
SELECT-OPTIONS PROJECT FOR WBS.
SELECTION-SCREEN: END OF BLOCK 02.
SELECTION-SCREEN: END OF BLOCK 01.
DATA: BEGIN OF IVBAK OCCURS 0,
VBTYP LIKE VBAK-VBTYP, "SD document category
AUART LIKE VBAK-AUART, "Sales Document Type
NETWR LIKE VBAP-NETWR, "NET VALUE OF THE ORDER ITEM
WAERK LIKE VBAK-WAERK, "SD document currency
PS_PSP_PNR LIKE VBAP-PS_PSP_PNR, "WBS Element
END OF IVBAK.
DATA: BEGIN OF IPRPS OCCURS 0,
PSPNR LIKE PRPS-PSPNR, "WBS Element
POSID LIKE PRPS-POSID, "WBS Element
OBJNR LIKE PRPS-OBJNR, "Object number
PSPHI LIKE PRPS-PSPHI, "Current project number
END OF IPRPS.
DATA: BEGIN OF ICOSP OCCURS 0,
OBJNR LIKE COSP-OBJNR,
GJAHR LIKE COSP-GJAHR,
WRTTP LIKE COSP-WRTTP,
BEKNZ LIKE COSP-BEKNZ,
WTG001 LIKE COSP-WTG001,
WTG002 LIKE COSP-WTG002,
WTG003 LIKE COSP-WTG003,
WTG004 LIKE COSP-WTG004,
WTG005 LIKE COSP-WTG005,
WTG006 LIKE COSP-WTG006,
WTG007 LIKE COSP-WTG007,
WTG008 LIKE COSP-WTG008,
WTG009 LIKE COSP-WTG009,
WTG010 LIKE COSP-WTG010,
WTG011 LIKE COSP-WTG011,
WTG012 LIKE COSP-WTG012,
WTG013 LIKE COSP-WTG013,
WTG014 LIKE COSP-WTG014,
WTG015 LIKE COSP-WTG015,
WTG016 LIKE COSP-WTG016,
SUM TYPE CURRENCY ,
END OF ICOSP.
*DATA: ICOSP LIKE COSP OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF ITAB OCCURS 0,
PSPNR LIKE VBAK-PS_PSP_PNR,
NETWR LIKE VBAP-NETWR,
END OF ITAB.
PERFORM IVBAK.
PERFORM IPRPS.
PERFORM ICOSP.
PERFORM MOVE_COSP.
PERFORM MOVE.
PERFORM FIELDCATALOG.
PERFORM BUILD_LAYOUT.
PERFORM ALVDISPLAY.
FORM IVBAK.
SELECT VBTYP AUART NETWR WAERK PS_PSP_PNR FROM VBAK INTO TABLE IVBAK
WHERE PS_PSP_PNR IN PROJECT AND
VBTYP = 'G' AND AUART = 'ZPCQ'.
CLEAR: IVBAK.
ENDFORM. "IVBAK
FORM IPRPS.
SELECT PSPNR POSID OBJNR PSPHI FROM PRPS INTO TABLE
IPRPS WHERE PRPS~PSPHI IN PROJECT.
CLEAR : IPRPS.
ENDFORM. "IVBAP
FORM ICOSP.
LOOP AT IPRPS.
SELECT OBJNR GJAHR WRTTP BEKNZ WTG001 WTG002 WTG003 WTG004 WTG005
WTG006 WTG007 WTG008 WTG009 WTG010 WTG011
WTG012 WTG013 WTG014 WTG015 WTG016
FROM COSP INTO CORRESPONDING FIELDS OF TABLE ICOSP
WHERE OBJNR = IPRPS-OBJNR AND WRTTP = '4'.
ENDLOOP.
CLEAR:ICOSP.
ENDFORM.
Thanks
Parihi,
try this Code
DATA : wbs LIKE vbak-ps_psp_pnr.
SELECTION-SCREEN: BEGIN OF BLOCK 01.
SELECTION-SCREEN: BEGIN OF BLOCK 02 WITH FRAME .
SELECT-OPTIONS project FOR wbs.
SELECTION-SCREEN: END OF BLOCK 02.
SELECTION-SCREEN: END OF BLOCK 01.
TYPES: BEGIN OF ivbak,
vbtyp LIKE vbak-vbtyp, "SD document category
auart LIKE vbak-auart, "Sales Document Type
netwr LIKE vbap-netwr, "NET VALUE OF THE ORDER ITEM
waerk LIKE vbak-waerk, "SD document currency
ps_psp_pnr LIKE vbap-ps_psp_pnr, "WBS Element
END OF ivbak.
TYPES: BEGIN OF iprps,
pspnr LIKE prps-pspnr, "WBS Element
posid LIKE prps-posid, "WBS Element
objnr LIKE prps-objnr, "Object number
psphi LIKE prps-psphi, "Current project number
END OF iprps.
TYPES: BEGIN OF icosp,
objnr LIKE cosp-objnr,
gjahr LIKE cosp-gjahr,
wrttp LIKE cosp-wrttp,
beknz LIKE cosp-beknz,
wtg001 LIKE cosp-wtg001,
wtg002 LIKE cosp-wtg002,
wtg003 LIKE cosp-wtg003,
wtg004 LIKE cosp-wtg004,
wtg005 LIKE cosp-wtg005,
wtg006 LIKE cosp-wtg006,
wtg007 LIKE cosp-wtg007,
wtg008 LIKE cosp-wtg008,
wtg009 LIKE cosp-wtg009,
wtg010 LIKE cosp-wtg010,
wtg011 LIKE cosp-wtg011,
wtg012 LIKE cosp-wtg012,
wtg013 LIKE cosp-wtg013,
wtg014 LIKE cosp-wtg014,
wtg015 LIKE cosp-wtg015,
wtg016 LIKE cosp-wtg016,
sum TYPE currency ,
END OF icosp.
*DATA: ICOSP LIKE COSP OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF itab,
pspnr LIKE vbak-ps_psp_pnr,
netwr LIKE vbap-netwr,
END OF itab.
DATA : i_ivbak TYPE STANDARD TABLE OF ivbak,
i_prps TYPE STANDARD TABLE OF iprps,
i_icosp TYPE STANDARD TABLE OF icosp,
wa_ivbak TYPE ivbak,
wa_prps TYPE prps,
wa_icosp TYPE icosp.
PERFORM ivbak.
PERFORM iprps.
PERFORM icosp.
*PERFORM MOVE_COSP.
*PERFORM MOVE.
*PERFORM FIELDCATALOG.
*PERFORM BUILD_LAYOUT.
*PERFORM ALVDISPLAY.
FORM ivbak.
SELECT vbtyp auart netwr waerk ps_psp_pnr FROM vbak
INTO TABLE i_ivbak
WHERE ps_psp_pnr IN project AND
vbtyp = 'G' AND auart = 'ZPCQ'.
ENDFORM. "IVBAK
*& Form IPRPS
* text
FORM iprps.
SELECT pspnr posid objnr psphi
FROM prps INTO TABLE
i_prps WHERE prps~psphi IN project.
ENDFORM. "IVBAP
*& Form ICOSP
* text
FORM icosp.
IF i_prps[] IS NOT INITIAL.
SELECT objnr gjahr wrttp beknz wtg001 wtg002 wtg003 wtg004 wtg005
wtg006 wtg007 wtg008 wtg009 wtg010 wtg011
wtg012 wtg013 wtg014 wtg015 wtg016
FROM cosp INTO CORRESPONDING FIELDS OF TABLE i_icosp
FOR ALL ENTRIES IN i_prps
WHERE objnr = i_prps-objnr AND wrttp = '4'.
ENDIF.
ENDFORM. "ICOSP
Regards
Sandipan
Maybe you are looking for
-
Why my iCloud backup doesn't download pictures in my Camera Roll ?
everything is in the title, my iCloud backup doesn't work perfectely, i m about to lose one year of pictures and videos. I'm a little bit upset to have paid 80 dollars for a service which doesn't work. should i ask for to be reimbursed ? The backup w
-
How to use the insert record and check username function?
Hi guys. I have an error that has me stumped. I have a form that inserts text from a text field into a mysql database and I have added a check user name function to check if this number already exists. Here's the page http://www.thechallenge.net.au/r
-
Characteristics without information in Queries of HR and PY
Hi All, Two questions: 1. I have two infocubes activated, Headcount and Personnel Actions (0PA_C01) and Employee-Specific Payroll Data (0PY_C02). I had made extraction for these two cubes and they all are green, no error showed. Both of these share
-
NetBeans and other software not available in the main solaris repository.
In the main(default) Solaris 11 Express repository we cannot find NetBeans and other software we could find in OpenSolaris in the extras repository,for example.Reading Solaris 11 Express release notes I find the main solaris repository and the suppor
-
How disable mac album art screen saver
I would like to disable the use of album art as a screen saver and rely instead on the photos included with Lion. How can I do this? Thanks. Jim Robbins