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
 wks.col.setformat uses wrong subformat index
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AKazak

Russia
1205 Posts

Posted - 09/02/2020 :  2:24:25 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2021 (64-bit) Beta 4 9.8.0.138
Windows 7 Pro x64 SP1

Greetings!

I want to set custom date format for a worksheet column and try to understand an example from https://www.originlab.com/doc/LabTalk/ref/Wks-Col-obj#Set_Custom_Date_FormatCustom_Date_FormatDate_Format.2C_Customization:

// Surround non-date characters in specifier by single quotes:
wks.col2.SetFormat(4, 22, yyyy'.'MM'.'dd);


Here subformat is set to 22, but the same page above tells:
quote:
Subformat options as listed in the Display drop-down list of the Worksheet Column Format dialog box (in the Origin GUI, select Format pull-down menu, then select Column ... option to open this dialog). To get the appropriate number of the option you want, simply count down from the top of the list of Display options. Make sure the desired Format has been selected first.


Here is my Display drop-down list:


The Custom Display option has a serial number (from top to bottom) of 24, but not 22.

Does the online help stay behind the Origin development or here is some different logic?

---
Andrey

cpyang

USA
1406 Posts

Posted - 09/02/2020 :  4:15:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Custom is special, so some later implementation inserted some additional entries but Custom=22 must stay the same due to people's existing codes.

CP

Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 09/03/2020 :  01:34:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

Custom is special, so some later implementation inserted some additional entries but Custom=22 must stay the same due to people's existing codes.

CP





So 22 corresponds to Custom Display.
How do I then pick 22nd and 23rd list items from the top, that are "9-2-2020 (Global Custom1)" and "09:21:37.0000 (Global Custom2)"?

---
Andrey
Go to Top of Page

minimax

357 Posts

Posted - 09/22/2020 :  04:19:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi AKazak,

index for 9-2-2020 (Global Custom1) is 20;
index for 09:21:37.0000 (Global Custom2) is 21;
index for Custom is 22;
index for 2020-W36 is 23 (new in Origin 2021);
index for 2020-W36-2 is 24 (new in Origin 2021);

Those 2 is another kind of "custom" format.

To modify those 2 format, go to Tools - Options - Miscellaneous Tab - Custom Dates Formats Group, the 2 editboxes.

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