function who return the length of an numeric item from the dictionnary

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
thierryt
Posts: 47
Joined: April 26th, 2017, 12:17 pm

function who return the length of an numeric item from the dictionnary

Post by thierryt »

Good morning,
please i need the function who return the length of an numeric item from the dictionnary. i know that the length of alpha item is return by the function LENGTH, but what about numeric item ?
Thanks
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: function who return the length of an numeric item from the dictionnary

Post by josh »

Do you need the max length allowed for the dictionary variable or the length in digits of the number of the current value?
thierryt
Posts: 47
Joined: April 26th, 2017, 12:17 pm

Re: function who return the length of an numeric item from the dictionnary

Post by thierryt »

Hi Josh,
i need the max length allowed for the dictionnary variable
Saint
Posts: 63
Joined: November 22nd, 2013, 4:59 am

Re: function who return the length of an numeric item from the dictionnary

Post by Saint »

Not sure what you mean.. Lets say if you have an entry of 333, you want to return the length as 3, and if you have 23456, you want to return the length as 5. Is that what you need a function for?
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: function who return the length of an numeric item from the dictionnary

Post by Gregory Martin »

If you don't have a value set, you can use the maxvalue function, which will return the highest value supported by the field. This should get you the length:
length(maketext("%d",maxvalue(ITEM_NAME)));
thierryt
Posts: 47
Joined: April 26th, 2017, 12:17 pm

Re: function who return the length of an numeric item from the dictionnary

Post by thierryt »

Hi Martin,
It is exactly what i wanted,
Thanks a lot.
Please can i have the function who return the number of cases of a data file ?
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: function who return the length of an numeric item from the dictionnary

Post by Gregory Martin »

That function doesn't exist in CSPro 6.3. In CSPro 7.0, which is now in beta, you can write:
keylist(DICT_NAME);
That will return the number of cases.
Post Reply