Automatied value sets

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Elvis

Automatied value sets

Post by Elvis »

Hi everybody,

I asking my self how to automatize a list of value sets to get them from a file (word or ecxel).

My idea is to create a file in a doc ex: young 15-35, old 35-60, and inport this file in this case ( young 15-35, old 35-60) in value sets automaticlly.

can anybody help me?

best regards Elvis
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Automatied value sets

Post by khurshid.arshad »

Dear

I have a presentation for you. I am trying to send this file but it give me an error because file size is 9MB. Give me your email address. Maybe it can help out. My email address is khurshid.arshad@gmail.com.

arshad
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Automatied value sets

Post by Gregory Martin »

If your value set lists are formatted properly, you can copy and paste them into CSPro. For example, in Excel, set up your value sets in the format:

Column 1: Label
Column 2: From value
Column 3: To value, if needed

Then copy these values From Excel and paste them into the value set editor within CSPro. It will recognize this as a value set and allow it to be pasted. The same is possible from Word.

You can also copy from CSPro and paste into Excel.
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Automatied value sets

Post by khurshid.arshad »

Dear Gregory;
Before pasting value sets, in Dictionary Macro is needed define only Value set Name in CSPro. Otherwise it will not work. Please Advise.
Regards.
Arshad
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Automatied value sets

Post by Gregory Martin »

Yes, when using Dictionary Macros, you need to define at least the name of a value set. This doesn't apply to my advise to Elvis though. If you're just copying and pasting a single value set, you don't need to define a name.

But the Dictionary Macros need to know, for each value set that is copied in, where it should be placed, so you'll have to create name. You can create a value set name for each variable without adding any value labels though. You can do this pretty quickly using keyboard shortcuts: Control+A, Tab, Tab, Escape.
Guest

Re: Automatied value sets

Post by Guest »

Hi Guys, thank you for you replies but what i want to do is to create a automated script, for ex, My friend have create a script that take the operator name without enter it from a file .txt , similar at this i want to create a script that take the value labels from a source and insert them to the right place.i don't now if you understand me or my English is very bad :p.
Have a nice day.
Elvis
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Automatied value sets

Post by Gregory Martin »

Creating an automated script to do this is possible, but nontrivial. If you want to do this while your program is running, you will have to use the setvalueset function along with two arrays, one for the values and one for the value labels.

If you can do this before you run your program, you could create your own dictionary file (.dcf). If you look at the contents of a dictionary file, you'll see text like this:

Code: Select all

[Item]
Label=mult
Name=MULT
Start=3
Len=1
Occurrences=5

[ValueSet]
Label=mult
Name=MULT_VS1
Value=0;Choice 0
Value=1;Choice 1
Value=2;Choice 2
Value=3;Choice 3
You could read in your dictionary file until you reach the correct item, and then after reading the proper values of the item, you could write out your own value set labels. This is definitely possible, though you'll have to know a bit about file input/output in whatever language your program this is in to do this successfully. Basically you'll search for the [Item] and Name= pairs, then read until the next blank line, and then write out your [ValueSet].
Post Reply