The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 wrcopy
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

maarnts

Netherlands
Posts

Posted - 09/30/2013 :  06:21:08 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 8.063.988 SR6
Operating System winXP:

I want to copy rows from one workbook_1 to another workbook_2
at a specific row number in workbook_2

I try to use the Xfunction wrcopy via labtalk.
However when I include the dr1:= option I get an error message
"Error: cannot find a (unique) variable corresponding to dr1"

When looking at the Xfunction code there seems no dr1 declared at all.
When excluding the dr1 function works perfect, but the row is always pasted at the first row of workbook_2.

Could you please help me with this problem?


greg

USA
1378 Posts

Posted - 09/30/2013 :  10:28:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Your version does not have the dr1 option. That was added after we realized the function had very limited use without it. (Not sure which version added the dr1.)

You can use the copydata function which just deals with continuous data ranges (and no labels) as in:

copydata irng:=[Book1]Sheet1!2:4[12] orng:=[Book2]Sheet1!6[3];

which copies the block of data from column 2, row 8 to column 4, row 12 in [Book1]Sheet1 to the block whose upper left is column 6, row 3 in [Book2]Sheet1.
Note that the target column must exist, but additional columns need not exist yet when the function executes.
Go to Top of Page

maarnts

Netherlands
Posts

Posted - 09/30/2013 :  11:01:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Unfortunately this workaround seems to work only for numeric data
(I have also text and dates in my data sets.)
Go to Top of Page

greg

USA
1378 Posts

Posted - 10/01/2013 :  5:04:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If your Dates (or Times) are formatted as Date (or Time) then they get treated as numerical values and are copied. If your Date values are NOT formatted as Date, then they will appear left-justified in a cell (like text). We of course recommend you do format any column with date values to be a Date format.

When copied, if the target column is not formatted as a Date then you will see Julian Day numbers, e.g. in the two million range.

A more general solution - one that works with Text as well - is a script that copies everything as text. Here is the script equivalent of the single copydata example I gave:

range rab1 = [Book1]Sheet1;
range rab2 = [Book2]Sheet1;
for(icol=2;icol<=4;icol++)
{
for(irow=8;irow<=12;irow++)
{
rab2!cell(3+irow-8,6+icol-2)$ = rab1!cell(irow,icol)$;
}
}

This assumes that all columns that will receive text are formatted as Text or Text&Numeric. A limitation here is that numeric values (or formatted Date values) copy only using display precision so you should set your source data to use maximum display precision.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000