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
 Forum for Origin C
 Worksheet Column Values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Campo

Germany
Posts

Posted - 06/02/2006 :  08:09:18 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR5
Operating System: WIN XP


I try to calculate some rows. For that I wrote following function:
quote:

vector<double> Reibweg_Hilfsfunction(vector<double>& ColDrehzahl, vector<double>& ColZeit)
{
vector<double> vecOut;
vecOut = Durchmesser * pi * ColDrehzahl / 60 * ColZeit * 3600;
return vecOut;
}




I wrote the function after that in Origin in the "Set Column Values" in this form:

Reibweg_Hilfsfunction(col(Zeit),col(Drehzahl))

by manually calculating all works fine.

Now i want to refill the worksheet with new data in form o a easy data import:

quote:


// diese Function ist für die function "void import_to_active_Daten_wks()" sowie für die Funktionen, die für das Öffnen von
// Excel und beschreiben der Wordvorlage verantwortlich sind, notwendig
// Ausgegeben wird eine Adresse wie zB: "C:\Dokumente und Einstellungen\Administrator\Desktop\ichbintoll.csv"

void stringfile(string)
{
PfadTriboversuch1 = GetOpenBox("*.csv");
}

//////////////////////////////////////////////////////////////////////////////////////////////////

// Importmöglichkeit, hier werden die Daten auf ein schon existierendes Worksheet überschrieben
// Tribodaten
void import_to_active_Daten_wks()
{

Worksheet wks("Daten");
// Worksheet wks = Project.ActiveLayer();
if(wks)
{
stringfile(PfadTriboversuch1); // neu verweis function stringfile
wks.ImportASCII(PfadTriboversuch1);
}

}





by manually calculating (right click on the row --> set column Values --> ok) all works again fine.

But if i want to automate this by activating the "Autoupdate" button in "Set Column Values", i get problems.
If i now start the function import_to_active_Daten_wks() the system crashs or i get a white worksheet with no rows and columns.

so what do i wrong?

Deanna

China
Posts

Posted - 06/04/2006 :  9:50:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi.

I guess the problem is that the importation OVERWRITES the column whose values should be autoupdated.

For example, you have a worksheet like this:


Note that the values of Column C is set by the first two columns and autoupdate is enabled.


If a file that contains only two columns is imported, Column C will be auto-updated sucessfully. However, if a file that contains three columns is imported, a warning that the file cannot be read is displayed and the worksheet becomes white.



Will you please check if the problem is related to the importing?

Deanna
OriginLab GZ Office

Edited by - Deanna on 06/04/2006 9:53:55 PM
Go to Top of Page

easwar

USA
1965 Posts

Posted - 06/04/2006 :  10:15:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Campo,

If like Deanna points out you are trying to import into locked columns that does have the problem of import wiping out the columns.

One get around is to not set the column values to auto update, but instead use code to update the values after the import with column class methods such as:


Worksheet wks = Project.ActiveLayer();
Column colObj(wks, 2);
colObj.ExecuteFormula();
// Note that you can also change the formula prgrammatically:
// colObj.SetFormula("col(B)*2");



Easwar
OriginLab

Go to Top of Page

Campo

Germany
Posts

Posted - 06/06/2006 :  04:38:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks a lot @ deanna and easwar!!!!!

it was really a overwrite problem. I could solve it.
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