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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 date into label

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
goldrake_22 Posted - 01/16/2015 : 07:16:51 AM
Hi

I need to copy a row that is in a worksheet and it contains dates in format dd-mm-yyyy HH:mm. if I use the following command

wrow2label iw:=[r2l]Sheet1! comment:=1;


What i get is the numbers corresponding to the dates but not the date in the same format as before.

How can I solve the problem?

Thanks,

Best regards,

Matteo
Origin 8.5.1 SR!
15   L A T E S T    R E P L I E S    (Newest First)
MariaRichard Posted - 02/18/2015 : 08:00:17 AM
Thanks all members for contributing in this forum. Keep it up.

[url=http://www.floridabusinessloans.net/bad-credit-business-loans.php]Bad Credit Business Loans[/url]|[url=http://www.floridabusinessloans.net/florida-bussines-loan.php]Florida Business Loans[/url]

aprilmitchell Posted - 02/10/2015 : 11:19:01 PM
This is working:

for (int ii = 1; ii <= wks.ncols; ii++) {
wks.col$(ii).setformat(4, 22, dd'-'MM'-'yyyy HH:mm); // Set col(ii) to be this format
}

April
lkb0221 Posted - 01/23/2015 : 1:26:05 PM
Would you mind update to latest SR version of 851 and try again?
Your script works fine in my SR2, at least.
goldrake_22 Posted - 01/23/2015 : 11:50:37 AM
quote:
Originally posted by lkb0221

Hi,

I tried in 8.5.1SR2 again and cannot see any problems.
Sorry... I don't not quite understand what the error you've running into. Please make sure the worksheet you want to operate on is the current activated one.
Would you mind share a little more details?

Zheng
OriginLab



Hi

I used this commands:

newbook name:="r2l" option:=lsname;


wrcopy iw:=[Book17]Sheet1! r1:=1 c1:=1 c2:=1 ow:=[r2l]Sheet1! transpose:=1;
win -a r2l;

loop(var, 1, wks.ncols){
wks.col$(var).setformat(4);
/};

This solution works but the date is in the format "dd-mm-yyyy".

If I use

newbook name:="r2l" option:=lsname;


wrcopy iw:=[Book17]Sheet1! r1:=1 c1:=1 c2:=1 ow:=[r2l]Sheet1! transpose:=1;
win -a r2l;

loop(var, 1, wks.ncols){
wks.col$(var).setformat(4,22, dd'-'MM'-'yyyy HH:mm);
/};


Then it does not transform the columns into date at all. It just copy the book17 c1 to the first row in r2l but in number format. I am using origin 8.5.1 SR1.


Thanks,

BR
Matteo
lkb0221 Posted - 01/22/2015 : 10:51:32 AM
Hi,

I tried in 8.5.1SR2 again and cannot see any problems.
Sorry... I don't not quite understand what the error you've running into. Please make sure the worksheet you want to operate on is the current activated one.
Would you mind share a little more details?

Zheng
OriginLab
goldrake_22 Posted - 01/22/2015 : 04:33:15 AM
quote:
Originally posted by lkb0221

Then try using a range variable, for example:

for (int ii = 1; ii <= wks.ncols; ii++) {
range rr = $(ii);
rr.setformat(4, 22, dd'-'MM'-'yyyy HH:mm);
}




Hi

it does not work still.
I have noticed though that the first solution you gave, which I had tried before,
for (int ii = 1; ii <= wks.ncols; ii++) {
wks.col$(ii).setformat(4, 22, dd'-'MM'-'yyyy HH:mm); // Set col(ii) to be this format
}

works if w
wks.col$(ii).setformat(4, 22, dd'-'MM'-'yyyy HH:mm);
so removing the customization. however I still want to be able to see the HH:mm which is not in the default date format.

Thanks,

BR
Matteo
lkb0221 Posted - 01/21/2015 : 09:29:06 AM
Then try using a range variable, for example:

for (int ii = 1; ii <= wks.ncols; ii++) {
range rr = $(ii);
rr.setformat(4, 22, dd'-'MM'-'yyyy HH:mm);
}
goldrake_22 Posted - 01/21/2015 : 06:10:29 AM
quote:
Originally posted by lkb0221

Try this:

for (int ii = 1; ii <= wks.ncols; ii++) {
wks.col$(ii).setformat(4, 22, dd'-'MM'-'yyyy HH:mm); // Set col(ii) to be this format
}



Hi again,
that is exactly what i tried even on my own but it does not work. it seems that it doesn´t take $(ii).The command
wks.col1.setformat(4, 22, dd'-'MM'-'yyyy HH:mm); works and manually putting there whatever number works as well.
How can I solve this?

Thanks,

BR
Matteo


wks.col$(ii).setformat(4, 22, dd'-'MM'-'yyyy HH:mm);

is not accepted as command. it does not
lkb0221 Posted - 01/20/2015 : 09:44:41 AM
Try this:

for (int ii = 1; ii <= wks.ncols; ii++) {
wks.col$(ii).setformat(4, 22, dd'-'MM'-'yyyy HH:mm); // Set col(ii) to be this format
}
goldrake_22 Posted - 01/20/2015 : 03:13:22 AM
Hi,

I would like all column to have this type of date:

dd-mm-yyyy HH:mm.

Br,

Matteo
lkb0221 Posted - 01/19/2015 : 10:37:53 AM
Can you be a little specific about what counter of date are you looking for? If it's highly customized, you will need to loop through all the rows to calculate it.
goldrake_22 Posted - 01/19/2015 : 05:42:15 AM
Thanks,
I have another question date-related. How do I make a script to change the format of all columns to a specific date format?

The problem arises from the fact that wks.colX.setformat does not accept as X a counter $(ii) coming from a for cycle. What command or workaround can I use?

Thanks again.
Matteo
lkb0221 Posted - 01/16/2015 : 10:38:09 AM
For example, assuming the row you want to set as comment is the 2nd one.

// Start
// With the worksheet activated
for (int ii = 1; ii <= wks.ncols; ii++) { // Loop through all columns
wks.col$(ii).comment$ = wcol(ii)[2]$; // Copy the cell value into comment as string
}
worksheet -s 0 2 0 2; // Select the 2nd row
DoMenu 36442; // Delete this row
// End
goldrake_22 Posted - 01/16/2015 : 10:16:00 AM
Hi!

How do I read them as string?

BR
Matteo

lkb0221 Posted - 01/16/2015 : 09:31:17 AM
Hi,

There is no format for column label rows. All of them are pure text.
So as a workaround, you can loop through the columns, read the cell data as string and put it into the comment.

Zheng
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000