Applescript to import cell data from Numbers table
I have 2 questions:
the first I am importing the value of cells from Numbers to a list within my script. The cell's orginal value is set to automatic, but it's a number:
833094
but what imports into my list is as follows:
8.33094+5
How might I handle this without changing the integrity of the Cell's value and data type?
Second question: Again, I am importing the values of a range of cells into a list, The cell's data type is date (e.g. July 24, 2013 12:21:10 AM.) The import to my list comes off OK, but when I attempt to set the same date type (date) back to a new cell I get an execusion error. All other data types (except date) seem to move from a my list to a cell without problem. How might I work around this problem
Thank you
I assume you can set the cell (using Applescript) with some format. You may need to set the format to "Automatic". Hopefully Hirohito or BadUnit who have more Applescript experience can assist. The actul value is there an correct. You can try it manually in Numbers on your own:
A1 is formatted automatic, B1 is formatted scientific:
I hope this helps.
Wayne
Similar Messages
-
Unable to import cell data from another sheet in Numbers
Hi. I have a column of cells that I need to import the values of (copy) from one SHEET to another (not a table within same sheet etc).
Recently moved to Numbers from buggy GoogleDocs/Drive. Within that i could =importrange and reference the cells in the other sheets tables.
Failing this, is it possible to allow my customers to view one table within my worksheet, i.e. only have one table viewable and the others not etc?
Thanks in advance. SiHi Si,
There are many ways of doing this in Numbers. If you will be sorting your column the function INDEX() could work for you. If you will not be sorting try this:
Click where you want your first cell to move to. Type "="
Navigate to your other sheet and click in the first cell you want to move.
Hit return.
your value should show in your new sheet.
Fill your newly made formula down the rest of the column.
Welcome to Numbers!
quinn -
How to access data from Cluster table....?
Hi Experts,
Can You plz tell How to import/read data from cluster table? Plz give me the syntaxes also..
Thanx in advance.Types of TABLES and the differences
Transparent tables
Pool tables
Cluster Tables
From the user point of view, all tables are used to store data and there is no difference in behavior or operation of these tables. All of them can be managed by using the standard OPEN SQL. However from the administrator point of view, transparent tables do exists with the same structure both in the directory as well as the database, exactly with the same data and fields. While other two are not transparent in the sense that they are not manageable directly using database system tools. We cannot use Native SQL statements on these tables. These are logical tables, which are arranged as records of transparent tables. -
Using FDM to load data from oracle table (Integration Import Script)
Hi,
I am using Integration Import Script to load data from oracle table to worktables in FDM.
i am getting following error while running the script.
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done
Attaching the full error report
ERROR:
Code............................................. -2147217887
Description...................................... Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
At line: 22
Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
Component........................................ upsWObjectsDM
Version.......................................... 1112
Thread........................................... 6260
IDENTIFICATION:
User............................................. ******
Computer Name.................................... *******
App Name......................................... FDMAPP
Client App....................................... WebClient
CONNECTION:
Provider......................................... ORAOLEDB.ORACLE
Data Server......................................
Database Name.................................... DBNAME
Trusted Connect.................................. False
Connect Status.. Connection Open
GLOBALS:
Location......................................... SCRTEST
Location ID...................................... 750
Location Seg..................................... 4
Category......................................... FDM ACTUAL
Category ID...................................... 13
Period........................................... Jun - 2011
Period ID........................................ 6/30/2011
POV Local........................................ True
Language......................................... 1033
User Level....................................... 1
All Partitions................................... True
Is Auditor....................................... False
I am using the following script
Function ImpScrTest(strLoc, lngCatKey, dblPerKey, strWorkTableName)
'Oracle Hyperion FDM Integration Import Script:
'Created By: Dhananjay
'Date Created: 1/17/2012 10:29:53 AM
'Purpose:A test script to import data from Oracle EBS tables
Dim cnSS 'ADODB.Connection
Dim strSQL 'SQL string
Dim rs 'Recordset
Dim rsAppend 'tTB table append rs object
'Initialize objects
Set cnSS = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
Set rsAppend = DW.DataAccess.farsTable(strWorkTableName)
'Connect to SQL Server database
cnss.open "Provider=OraOLEDB.Oracle.1;Data Source= +server+;Initial Catalog= +catalog+;User ID= +uid+;Password= +pass+"
'Create query string
strSQL = "Select AMOUNT,DESCRIPTION,ACCOUNT,ENTITY FROM +catalog+.TEST_TMP"
'Get data
rs.Open strSQL, cnSS
'Check for data
If rs.bof And rs.eof Then
RES.PlngActionType = 2
RES.PstrActionValue = "No Records to load!"
Exit Function
End If
'Loop through records and append to tTB table in location’s DB
If Not rs.bof And Not rs.eof Then
Do While Not rs.eof
rsAppend.AddNew
rsAppend.Fields("PartitionKey") = RES.PlngLocKey
rsAppend.Fields("CatKey") = RES.PlngCatKey
rsAppend.Fields("PeriodKey") = RES.PdtePerKey
rsAppend.Fields("DataView") = "YTD"
rsAppend.Fields("CalcAcctType") = 9
rsAppend.Fields("Amount") = rs.fields("Amount").Value
rsAppend.Fields("Desc1") = rs.fields("Description").Value
rsAppend.Fields("Account") = rs.fields("Account").Value
rsAppend.Fields("Entity") = rs.fields("Entity").Value
rsAppend.Update
rs.movenext
Loop
End If
'Records loaded
RES.PlngActionType = 6
RES.PstrActionValue = "Import successful!"
'Assign Return value
SQLIntegration = True
End Function
Please help me on this
Thanks,
Dhananjay
Edited by: DBS on Feb 9, 2012 10:21 PMHi,
I found the problem.It was because of the connection string.The format was different for oracle tables.
PFB the format
*cnss.open"Provider=OraOLEDB.Oracle.1;Data Source= servername:port/SID;Database= DB;User Id=aaaa;Password=aaaa;"*
And thanks *SH* for quick response.
So closing the thread......
Thanks,
Dhananjay -
Using FDM Import Action script to import data from ERPI table "tdataseg_t"
Hi Experts
I have extracted data from EBS using ERPI and loaded into the intermediate table "tdataseg_t"
I am trying to use Import Action script within FDM to extract data from "tdataseg_t" table (where ERPI extract data is stored) as i could not use the normal import script.
Requirement : I have to restrict the custom 2 dimension based on Account dimension.
Dim Account
Account = ???? ( i am struck here)
If Account = 1000 to 5000 Then
Custom2 = Right( product , 5)
End If
but , I could not find the exact syntax to call the Account dimension from the "tdataseg_t" table.
Please Advise
Thanks
Sak
Edited by: user12292415 on Feb 26, 2012 1:19 AMHello,
Importing data via a manual script defeats the purpose of ERPi. As it will not provide you an audit trail, drill-through/drill-back, etc.
Your best bet is to use the default settings by the software. Just because it returns more records than you want is not a bad thing. You can conditionally change/alter the information either in an EventScript inside of FDM or by mapping the un-needed information to IGNORE.
Thank you, -
Import data from few tables and export into the same tables on different db
I want to import data from few tables and export into the same tables on different database. But on the target database, additional columns have been added
to the same tables. how can i do the import?
Its urgent can anyone please help me do this?
Thanks.Hello Junior DBA,
maybe try it with the "copy command".
http://download.oracle.com/docs/cd/B14117_01/server.101/b12170/apb.htm
Have a look at the section "Understanding COPY Command Syntax".
Here is an example of a COPY command that copies only two columns from the source table, and copies only those rows in which the value of DEPARTMENT_ID is 30:Regards
Stefan -
How do I export Dates from Numbers to iCal?
I'm building a spread sheet in *Numbers '08* with +expiration dates+ for many of the line items. I would like to export those dates to iCal so that iCal can _show/send me a reminder on those dates_. I've read that some people may be using a program called Bento to interface between Numbers & iCal. Seems like one should not have to buy an entire software program to export a simple date from Numbers to ICal -- both being native Apple programs.
Perhaps there is a way to get Numbers to send date reminders without exporting to iCal?
Any feedback is much appreciated.Here is the script doing the trick with Numbers '09.
--[SCRIPT createical_events_fromNumbers'09]
Enregistrer le script en tant que Script : createical_events_fromNumbers'09.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Sélectionner les cellules d'une table de Numbers qui décrivent des 'events'
La table est censée contenir:
une colonne avec la description des événements
une colonne avec les date_heures de début
une colonne avec les date_heures de fin
Éditer la property 'theCalendar' en fonction du nom du calendrier à alimenter.
menu Scripts > Numbers > createical_events_fromNumbers'09
Le script crée les évènements dans iCal
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
--=====
Save the script as a Script: createical_events_fromNumbers'09.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
In a table from Numbers '09,
select cells describing 'events'.
This table is supposed to embed :
a column storing events descriptions
a column storind start datetime
a column storing end datetime.
Edit the instruction defining the calendar name to fit your needs.
menu Scripts > Numbers > createical_events_fromNumbers'09
The script will create new events in iCal.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
This script creates new events from the content of selected cells from a Numbers '09 table.
--=====
example:
event #1 18 avr. 2010 05:35 19 avr. 2010 15:35
event #2 19 avr. 2010 05:35 20 avr. 2010 15:35
event #3 20 avr. 2010 05:35 21 avr. 2010 15:35
event #4 21 avr. 2010 05:35 22 avr. 2010 15:35
--=====
Yvan KOENIG (VALLAURIS, France)
2010/03/25
--=====
property theCalendar : "Personnel"
property nbItemsPerEvent : 3
--=====
on run
set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
set colNum2 to colNum1 + nbItemsPerEvent - 1
tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
repeat with r from rowNum1 to rowNum2
set eProps to {}
repeat with c from colNum1 to colNum2
copy (value of cell r of column c) to end of eProps
end repeat -- with column
Now, eProps contains
- the event description
- the start date_time
- the end date_time
my makeEvent(eProps)
end repeat
end tell -- Numbers
end run
--=====
on makeEvent({descr, sDate, eDate})
tell application "iCal"
make new event at the end of events of (every calendar whose name is theCalendar) with properties {description:descr, start date:sDate as text, end date:eDate as text, allday event:true}
end tell
end makeEvent
--=====
on getSelParams()
local r_Name, t_Name, s_Name, d_Name, col_Num1, row_Num1, col_Num2, row_Num2
set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
if r_Name is missing value then
if my parleAnglais() then
error "No selected cells"
else
error "Il n'y a pas de cellule sélectionnée !"
end if
end if
set two_Names to my decoupe(r_Name, ":")
set {row_Num1, col_Num1} to my decipher(item 1 of two_Names, d_Name, s_Name, t_Name)
if item 2 of two_Names = item 1 of two_Names then
set {row_Num2, col_Num2} to {row_Num1, col_Num1}
else
set {row_Num2, col_Num2} to my decipher(item 2 of two_Names, d_Name, s_Name, t_Name)
end if
return {d_Name, s_Name, t_Name, r_Name, row_Num1, col_Num1, row_Num2, col_Num2}
end getSelParams
--=====
set {rowNumber, columnNumber} to my decipher(cellRef,docName,sheetName,tableName)
apply to named row or named column !
on decipher(n, d, s, t)
tell application "Numbers" to tell document d to tell sheet s to tell table t to return {address of row of cell n, address of column of cell n}
end decipher
--=====
set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
on getSelection()
local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
tell application "Numbers" to tell document 1
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of tables
if x > 0 then
repeat with y from 1 to x
try
(selection range of table y) as text
on error errMsg number errNum
set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
return {theDoc, theSheet, theTable, theRange}
end try
end repeat -- y
end if -- x>0
end tell -- sheet
end repeat -- i
end tell -- document
return {missing value, missing value, missing value, missing value}
end getSelection
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) jeudi 25 mars 2010 22:50:17 -
Adding Data From One Table to Another
Now, this doesn't strike me as a particularly complex problem, but I've either strayed outside the domain of Numbers or I'm just not looking at the problem from the right angle. In any case, I'm sure you guys can offer some insight.
What I'm trying to do is, essentially, move data from one table to another. One table is a calendar, a simple two column 'date/task to be completed' affair, the other is a schedule of jogging workouts, i.e, times, distances. Basically, I'm trying to create a formula that copies data from the second table onto the first but only for odd days of the week, excepting Sundays (and assuming Monday as the start of the week). Now, this isn't the hard part, I can do that. The problem comes when I replicate the formula down the calendar. Even on the days when the 'if' statement identifies it as an 'even day', the cell reference to the appropriate workout on the second table is incremented, so when it comes to the next 'odd day', it has skipped a workout.
I can't seem to see any way of getting it to specifically copy the NEXT line in the second table, and not the corresponding line.
This began as a distraction to try and organise my running so I could see at a glance what I had to do that day and track my progress, but now it's turned into an obsession. SURELY there's a solution?
Cheers.Hi Sealatron,
Welcome to Apple Discussions and the Numbers '09 forum.
Several possible ways to move the data occur to me, but the devil's in the details of how the data is currently arranged.
Is it
• a list of three workouts, one for each of Monday, Wednesday and Friday, then the same three repeated the following week?
• an open-ended list that does not repeat?
• something else?
Regards,
Barry -
Data from word tables to excel master spreadsheet
Hello, I'm looking to take data from my damage report forms that come in maybe 20 times a week. This data needs to goto a master excel spreadsheet. I've managed to find a macro that does this but it does not paste it into excel the way I require and also
extracts data I do not require.
The word document contains a column of headings on the left, these will be the master spreadsheet sheet column headers. These will be on the spreadsheet already so I don't need them copied.
The other two columns contains the data I will need to xfer to excel. I was thinking bookmarks can help here but I'm unsure if these will save over from the original template?
So, if there is some code out there that can help, brilliant. It will be an excel macro in the master spreadshee. TThat takestthe datadfrom the active word doc or by selecting the word doc in its folder.
Fingers crossed.
JosephHi Joseph,
You should be able to run below code to get the data out of the Tabel(s) of a Word Document from within Excel.
You can modify the code accordingly to your needs to specify the range where you want the data to be copied.
I have already slightly modified the code to skip the header information.
Sub ImportWordTable()
Dim wdDoc As Object
Dim wdFileName As Variant
Dim TableNo As Integer 'table number in Word
Dim iRow As Long 'row index in Excel
Dim iCol As Integer 'column index in Excel
wdFileName = Application.GetOpenFilename("Word files (*.docx),*.docx", , _
"Browse for file containing table to be imported")
If wdFileName = False Then Exit Sub '(user cancelled import file browser)
Set wdDoc = GetObject(wdFileName) 'open Word file
With wdDoc
TableNo = wdDoc.tables.Count
If TableNo = 0 Then
MsgBox "This document contains no tables", _
vbExclamation, "Import Word Table"
ElseIf TableNo > 1 Then
TableNo = InputBox("This Word document contains " & TableNo & " tables." & vbCrLf & _
"Enter table number of table to import", "Import Word Table", "1")
End If
With .tables(TableNo)
'copy cell contents from Word table cells to Excel cells
' start with row 2 to skip headers
For iRow = 2 To .Rows.Count
For iCol = 1 To .Columns.Count
' Define starting point here
Cells(iRow - 1, iCol) = WorksheetFunction.Clean(.cell(iRow, iCol).Range.Text)
Next iCol
Next iRow
End With
End With
Set wdDoc = Nothing
End Sub
The source is this link:
Export Word Table in Excel
Also this Forum is more for generic Excel questions, for better response post in Excel For Developer Forum.
Hope this helps,
Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
Please vote an answer helpful if they helped. Please mark an answer(s) as an answer when your question is being answered. -
I don't even know if this is posible.
I'm using iwork '09
View PDFI hope I can clarify:
For our purposes here:
Table 1 = "Step 2 - Product Sizes"
Table 2 = "Option id Master"
Table 3 = "Export - Product Info"
Table 1:
The user would enter values for "productcode," "Horz," and "Vert"
"Size" would auto fill based on values in Horiz and Vert (I have this taken care of already).
Table 2: This is a completely static table that I want to search against. - Data from other tables in the doc does not alter or change the data in this doc.
We just want to look at table 2. Find the existing value in "table 2 : size" column that matches the "table 1 : size" column and then pull the "optionids" and "productprice" from that row.
Can the value from "Table 1 : Size" be used as a search term in "Table 2 : Size?"
Table 3: The user does not enter any values on this table.
"productcode" is pulled from table 1 - "Table 1 :: A5" = "Table 3 :: A5"
"optionids" and "productprice" are pulled from Table 2 columns "D" and "E" - however we do not know which Table 2 row it is pulling from until we enter data in Table 1.
As I'm writing this I'm realizing that
A. this is probably really confusing to you.
B. this may be impossible inside of numbers.
If you have some other method that would facilitate the same out come but be structured differently please let me know.
--- maybe to help you understand further what I am doing here is my current workflow:
I record the size of a piece of art.
Then I manually go to my "Option id Master" and find the same size.
I then copy the corresponding "optionids" and "productprice" cells. (these options control the prices displayed on my website)
I got to my "Export - Product Info" table and paste the values in the corresponding cells.
I was hoping to automate this as it takes a long time when you have hundreds of products.
Thanks for the help! -
How do I make data from one Table flow into a separate Table
How do I make data from one Table flow into a separate Table in iworks numbers?
Great stuff Yvan,
KOENIG Yvan wrote:
Here you may see the way to transfer the contents of a column of Table A in a column of Table B
I used two kinds of formulas.
In the cell A2 of Table B
the formula is :
=Table A :: $B2
It may be :
=Table A :: $B
Apply Fill Down
Copy paste it in cell A1 which is in a header row.
This formula does its duty but it’s not robust enough and will not survive to a Sort.
This is why in B2, I inserted a more robust formula :
=OFFSET(Table A :: $A$1,ROW()-1,2)
You will find details about the functions used in Numbers User Guide delivered with every copy of iWork ‘08
Yvan KOENIG (VALLAURIS, France) samedi 6 août 2011 17:45:22
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !
The first suggestion was the simple answer I needed,
Thank you -
MySQL move date from one table to another
I was wondering if there is a MySQL command that will let me move a selected row of data from one table to another. both tables have the same columns and declaration type (one table is actually an archived table on old data)
example
I wasnt to move all data in Table1 where the date is greater than 30 days old to Table 2
-- so the result should be...import all rows to Table 2 where the date is greater than 30 days old..and delete all date from Table 1 that is greater than 30 days.
currently..I'm doing three process
1) get all row that is greater than 30 days
"SELECT * FROM Table1 WHERE TO_DAYS(NOW()) - TO_DAYS(dateField) > 30"
2) insert data into Table2
while (res.hasNext())
TableData data = ..... // .get row
dataList.add(data);
for (int i = 0; i < dataList.size(); i++){
pstm.setString.....
pstm.addBatch()
pstm.executeBatch();
3) delete data from Table1
"DELETE FROM Table 1 WHERE TO_DAYS(NOW()) - TO_DAYS(dateField) > 30"for this app..losing a few rows does not
impact on how we analyze the data.That's what everyone always tells me too. But 99% of the time they come back and want to know why the cannot balance and/or validate the data between two runs taken only minutes from each other.
I've seen people puzzle over data for days that they swear they ran the exact same utility for their tests, but they were in fact using live data, and additional data had accrued but since all they had to do was execute the a script without parameters (they didn't put in a stop time), they got two different answers and it always, and I mean always confuses people. Be safe, and put the option in for and end date/time, then when they waste days trying to figure out why the two different observations gave them different numbers, they cannot blame you (because you gave them the option)!
My 2 cents for the day... -
Copying large amount of data from one table to another getting slower
I have a process that copies data from one table (big_tbl) into a very big archive table (vb_archive_tbl - 30 mil recs - partitioned table). If there are less than 1 million records in the big_tbl the copy to the vb_archive_table is fast (-10 min), but more importantly - it's consistant. However, if the number of records is greater than 1 million records in the big_tbl copying the data into the vb_archive_tbl is very slow (+30 min - 4 hours), and very inconsistant. Every few days the time it takes to copy the same amount of data grows signicantly.
Here's an example of the code I'm using, which uses BULK COLLECT and FORALL INSERST to copy the data.
I occasionally change 'LIMIT 5000' to see performance differences.
DECLARE
TYPE t_rec_type IS RECORD (fact_id NUMBER(12,0),
store_id VARCHAR2(10),
product_id VARCHAR2(20));
TYPE CFF_TYPE IS TABLE OF t_rec_type
INDEX BY BINARY_INTEGER;
T_CFF CFF_TYPE;
CURSOR c_cff IS SELECT *
FROM big_tbl;
BEGIN
OPEN c_cff;
LOOP
FETCH c_cff BULK COLLECT INTO T_CFF LIMIT 5000;
FORALL i IN T_CFF.first..T_CFF.last
INSERT INTO vb_archive_tbl
VALUES T_CFF(i);
COMMIT;
EXIT WHEN c_cff%NOTFOUND;
END LOOP;
CLOSE c_cff;
END;
Thanks you very much for any advice
Edited by: reid on Sep 11, 2008 5:23 PMAssuming that there is nothing else in the code that forces you to use PL/SQL for processing, I'll second Tubby's comment that this would be better done in SQL. Depending on the logic and partitioning approach for the archive table, you may be better off doing a direct-path load into a staging table and then doing a partition exchange to load the staging table into the partitioned table. Ideally, you could just move big_tbl into the vb_archive_tbl with a single partition exchange operation.
That said, if there is a need for PL/SQL, have you traced the session to see what is causing the slowness? Is the query plan different? If the number of rows in the table is really a trigger, I would tend to suspect that the number of rows is causing the optimizer to choose a different plan (with your sample code, the plan is obvious, but perhaps you omitted some where clauses to simplify things down) which may be rather poor.
Justin -
Copying data from one table to another, but not duplicate
Good afternoon!
I am new to Oracle SQL, I have a difficulty.
I have a script that copies or add another table with data from another table.
If the table already has 01 "Registry 01" when you make a copy of the data in table 02, can not duplicate the "Registry 01" again.
As the table already exists since the beginning of the year before last and duplicate information, I can not apply the UNIQUE constraint because of the error. I have to make this change from now.
How to perform this validation so that no duplicate data?
DECLARE
w_cont NUMBER;
CURSOR c_simpro IS
SELECT sc.cd_simpro,
sc.ds_produto,
sp.qt_embalagem,
MAX(sp.dt_vigencia)
FROM simpro_cadastro sc,
simpro_preco sp
WHERE sc.cd_simpro = sp.cd_simpro
GROUP BY sc.cd_simpro,
sc.ds_produto,
sp.qt_embalagem;
BEGIN
FOR r_simpro IN c_simpro LOOP
w_cont := 0;
SELECT COUNT(1)
INTO w_cont
FROM pls_material pm
WHERE pm.cd_material_ops = r_simpro.cd_simpro;
IF w_cont = 0 THEN
INSERT INTO pls_material(nr_sequencia,
dt_atualizacao,
nm_usuario,
dt_atualizacao_nrec,
nm_usuario_nrec,
ie_tipo_despesa,
cd_estabelecimento,
nr_seq_estrut_mat,
cd_simpro,
ds_material,
ie_situacao,
ds_material_sem_acento,
dt_inclusao,
cd_material_ops_orig,
cd_unidade_medida,
cd_material_ops,
qt_conversao_simpro)
VALUES(pls_material_seq.nextval,
SYSDATE,
'ES-SIMPRO',
SYSDATE,
'ES-SIMPRO',
3,
1,
3,
r_simpro.cd_simpro,
r_simpro.ds_PRODUTO,
'A',
r_simpro.ds_PRODUTO,
SYSDATE,
r_simpro.cd_simpro,
'un',
TRIM(to_char(r_simpro.cd_simpro,'0000099999')),
r_simpro.qt_embalagem);
COMMIT;
END IF;
IF w_cont > 0 THEN
UPDATE pls_material p
SET p.qt_conversao_simpro = r_simpro.qt_embalagem,
p.dt_atualizacao = SYSDATE
WHERE p.cd_simpro = r_simpro.cd_simpro;
COMMIT;
END IF;
END LOOP;
END;
Edited by: 983464 on 22/01/2013 10:30Hi,
in addition to what Marwin has already said, I suggest you to post CREATE TABLE and INSERT statements (as mentioned in the FAQ).
The error you are getting from MERGE command is because you need a way to uniquely identify within the table. So it's is important to know also if your table has a primary key/unique index so the keys could to be used in the MERGE command.
Additionally when you put some code or output please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
Regards.
Al -
Performance Issue - Fetching latest date from a507 table
Hi All,
I am fetching data from A507 table for material and batch combination. I want to fetch the latest record based on the value of field DATBI. I have written the code as follows. But in the select query its taking more time. I dont want to write any condition in where claue for DATBI field because I have already tried with that option.
SELECT kschl
matnr
charg
datbi
knumh
FROM a507
INTO TABLE it_a507
FOR ALL ENTRIES IN lit_mch1
WHERE kschl = 'ZMRP'
AND matnr = lit_mch1-matnr
AND charg = lit_mch1-charg.
SORT it_a507 BY kschl matnr charg datbi DESCENDING.
DELETE ADJACENT DUPLICATES FROM it_a507 COMPARING kschl matnr charg.Hi,
These kind of tables will be storing large volumes of data. Thus while making a select on it, its important to use as many primary key fields as possible in the where condition. Here you can try mentioning KAPPL since its specific to a requirement. If its for purchasing use 'M' and try.
if not lit_mch1[] is initial.
SELECT kschl
matnr
charg
datbi
knumh
FROM a507
INTO TABLE it_a507
FOR ALL ENTRIES IN lit_mch1
WHERE kappl = 'M'
AND kschl = 'ZMRP'
AND matnr = lit_mch1-matnr
AND charg = lit_mch1-charg.
endif.
SORT it_a507 BY kschl matnr charg datbi DESCENDING.
DELETE ADJACENT DUPLICATES FROM it_a507 COMPARING kschl matnr charg.
This should considerably increase the performance
Regards,
Vik
Maybe you are looking for
-
Sharing iTunes library with other users (on Vista)
I'm posting this for my sister who just purchased a new computer running Vista. She's set up a user account for herself as well as one for each of my two nephews. We've successfully moved over her iTunes music folder from her laptop and can now acces
-
Connect MacBook 2010 to two external monitors
I have a VGA cable that has an adapter that turns into USB and another one that is an adapter for an HDMI so it can go into my laptop. The one with the HDMI works, but the USB/VGA one doesn't work. Any suggestions?
-
ESS/MSS in multiclient szenario
Hello, we want to use on one portal two ESS/MSS (Erp2005) szenarios pointing to different backend clients. What we did so far: 1. Copy the Business Portal in portal to a second folder 2. Redirect the JCo Connections of copied iViews to new client 3.
-
Insert a Picture Into a Panel....
How can i insert a picture into a JPanel. Actually I want to show the picture only to the left hand side of the JFrame. Kindly help me. Thanx
-
What all to be consider to make an application Internationalization
hai friends, I am creating an application to be used in 2 different languages. ie the concept of internationalization, what all the thing's i just consider in developing ex,Date, etc.... Can u people help me out. Thanking You, Sudhan