A problem with numbers

Using SuperCard and the Runtime Editor... working with windows, backgrounds, cards and menus.

A problem with numbers

Postby JoeKoomen2011 » Fri Aug 04, 2017 1:39 pm

I have a database-like project in which I track all the fiction I’ve read. Each card in the main window is named after the title of the book reviewed on that card.

Naming a card with a combination of numbers and words works fine for sorting and with the listKey command (example: The 18½ Minute Gap). So only whole numbers are an issue. I have an infamous short story titled “555”. When I used that as the card name SuperCard would go to the 555th card in the window instead of going to the card with that name. My initial solution was to use isNumber to detect titles that were numeric and insert a # sign in front of them. This worked at one stage, but in one of the recent betas it stopped. Sorting still works fine, and the listKey goes to the right line in my list field when I type #, but the card won’t open.

I know it’s a bad idea to name things with numbers in SuperCard so I’m having a problem here.

Adding a # before the name was already a counter-intuitive move. I have read “1984” but have no idea who I would handle automatically rename a numbered story.

My two examples written out should be “five-five-five” and “Nineteen-Eighty-Four”, but any auto transform would give me “Five-hundred and fifty-five” and “One-thousand nine-hundred and eighty-four”. That won't do.

Any suggestions?
Joe Koomen
>> Random! ...Damn near killed 'em! <<
User avatar
JoeKoomen2011
 
Posts: 447
Joined: Thu Mar 12, 2009 1:38 pm

Re: A problem with numbers

Postby Scott » Sun Aug 06, 2017 12:51 am

I may not be seeing the whole picture here but why not just precede the cards named with an integer with the letter 'a' and then use something like the function below instead of the 'go cd cardDescriptor' command?

Code: Select all
function goCard thecard
   if isnumber(thecard) then
      put "a"&thecard into thecard
   end if
   go cd thecard
end goCard
User avatar
Scott
Site Admin
 
Posts: 1203
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: A problem with numbers

Postby JoeKoomen2011 » Mon Aug 07, 2017 1:48 pm

Thanks Scott,

That makes much more sense.

Joe
Joe Koomen
>> Random! ...Damn near killed 'em! <<
User avatar
JoeKoomen2011
 
Posts: 447
Joined: Thu Mar 12, 2009 1:38 pm

Re: A problem with numbers

Postby Anderson » Thu Aug 10, 2017 3:03 pm

What happens if you put a (blank) space before the name?
Anderson.
iMac - Yosemite - SC(4.73)
User avatar
Anderson
 
Posts: 204
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: A problem with numbers

Postby JoeKoomen2011 » Fri Aug 11, 2017 4:40 am

My index click list doesn't sort very well with a space in front. With the "a" in front at least all the numbers are bunched together. Also the SPACE is a delimiter for so many things I'd rather not have it in front or behind anything that it doesn't need to be. See below.

1984
555
...And now you don't
18 missing minutes
Apples and Oranges

vs.

...And now you don't
18 missing minutes
a1984
a555
Apples and Oranges
Joe Koomen
>> Random! ...Damn near killed 'em! <<
User avatar
JoeKoomen2011
 
Posts: 447
Joined: Thu Mar 12, 2009 1:38 pm

Re: A problem with numbers

Postby DaveFrancis » Wed Aug 16, 2017 12:28 pm

FWIW I have a huge database type project that lists all my diecast models, about 3000 to date. To identify the actual name of each model, I precede it with numToChar (202), (the character I call a 'sticky-space' but can't remember why). I've been using this project for donkey's years and so far have never had a problem with scripts identifying model names.

HTH, Dave.
DaveFrancis
 
Posts: 294
Joined: Fri Mar 06, 2009 5:12 pm

Re: A problem with numbers

Postby JoeKoomen2011 » Thu Aug 17, 2017 6:58 am

Putting numToChar(202) after numerical titles allows everything to sort properly and also allows my list fields to sort and react correctly to mouse clicks.

Thanks for the suggestion.

Joe
Joe Koomen
>> Random! ...Damn near killed 'em! <<
User avatar
JoeKoomen2011
 
Posts: 447
Joined: Thu Mar 12, 2009 1:38 pm

Re: A problem with numbers

Postby DaveFrancis » Fri Aug 18, 2017 1:20 pm

:-)
DaveFrancis
 
Posts: 294
Joined: Fri Mar 06, 2009 5:12 pm


Return to SuperCard Basics

Who is online

Users browsing this forum: No registered users and 1 guest

cron