What am I doing wrong? 
Author Message
 What am I doing wrong?

Hi all,

I LOVE THIS C5 - but what worked in 2003 doesn't fly now.  What I am doing
is creating an ascii file for emailing.  Since I receive these emails from
several companies I needed to give each a variable file name.

So in the dict i used !glo:code

and running the program i used the following

open(owner)
get(owner,1)
glo:code=sub(own:phone,4,7)&'.txt'
open(trudisp)
if errorcode() then create(trudisp).
empty(trudisp)

this created the file name to be sent like 1234.txt.  C5 will not recognise
the numbers and will give me a file named txt~1

Any ideas greatly appreciated



Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
Hi Don,

1 - CODE is not a nice word to use in a variable name.  Might try
another like glo:CodeName.

2 - Don't you want sub(own:phone, 4, 4) assuming phone is in 999-9999
format?

____________________________________

Data Concepts Unlimited - USA
http://www.dcunlimited.com

Quote:

>So in the dict i used !glo:code



Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
Hi David,
You are right, CODE probably was a poor choice, will go back and change it
and see what happens.

And I think you just pointed out my error, it should be sub 7,4 in that the
phone number also includes the area code 777 999 9999 in that I want to pick
up the last 4 digits of the number.

Don

Quote:

>Hi Don,

>1 - CODE is not a nice word to use in a variable name.  Might try
>another like glo:CodeName.

>2 - Don't you want sub(own:phone, 4, 4) assuming phone is in 999-9999
>format?

>____________________________________

>Data Concepts Unlimited - USA
>http://www.dcunlimited.com


>>So in the dict i used !glo:code



Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?

Quote:
>glo:code=sub(own:phone,4,7)&'.txt'
>this created the file name to be sent like 1234.txt.  C5 will not recognise
>the numbers and will give me a file named txt~1

Do you have valid characters for a file name?
What's the content of own:phone ?
--



Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
One other thing to remember, too.  You need to follow a Create() with an Open().


Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
Hello Don,
I noticed that you're using 'get(owner,1) which will work
correct with a Clarion file. If it is a Topspeed file a SET/NEXT
command would be more appropiate to avoid getting a
wrong record. Refer also to the POSITION command in your
LRM.

I tend to doubt that 'glo:code=sub(own:phone,4,7)&'.txt' '
returns '1234.txt'. You're asking the string value of own:phone
starting at position 4 and 7 character long.
I may then assume that the string own:phone is at least 11
characters long.
If there are only 4 characters from position 4 in own:phone
then sub(own:phone,4,7)&'.txt'  would result in '1234   .txt'
See the spaces after the 4 that you have requested by the
data from position 4 and 7 characters long.

I would suggest that you experiment and find out if the
problem really lies with C5. You could also start the file
with a non numeric character and see how that works out.

By the way string slicing is more efficient than the sub
function.
You could use glo:code=own:phone[4,7] &'.txt'.

I noticed that you want to create your file 'Trudisp' if an
error is encounterd but in that situation you should also
explicity open your file after the create.
open(trudisp)
if errorcode() = 2  !Create only if file was not found
 create(trudisp)
 open(trudisp)
end
empty(trudisp)

Regards,
Marius Luidens

Quote:

> Hi all,

> I LOVE THIS C5 - but what worked in 2003 doesn't fly now.  What I am doing
> is creating an ascii file for emailing.  Since I receive these emails from
> several companies I needed to give each a variable file name.

> So in the dict i used !glo:code

> and running the program i used the following

> open(owner)
> get(owner,1)
> glo:code=sub(own:phone,4,7)&'.txt'
> open(trudisp)
> if errorcode() then create(trudisp).
> empty(trudisp)

> this created the file name to be sent like 1234.txt.  C5 will not recognise
> the numbers and will give me a file named txt~1

> Any ideas greatly appreciated



Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
Thanks everyone - Yep, I finally got it to working, but I am going back and
change some of the code based on the suggestions.

The owner file is just a one record file that contains the clinet's name,
address, phones, etc.

I developed this little program because all these truck companies fax their
truck list and I am tired of retyping - get them to send this and it can
just be sucked in (it's called the laziness factor)

Thanks again

Don Harvey

Quote:

>Hi all,

>I LOVE THIS C5 - but what worked in 2003 doesn't fly now.  What I am doing
>is creating an ascii file for emailing.  Since I receive these emails from
>several companies I needed to give each a variable file name.

>So in the dict i used !glo:code

>and running the program i used the following

>open(owner)
>get(owner,1)
>glo:code=sub(own:phone,4,7)&'.txt'
>open(trudisp)
>if errorcode() then create(trudisp).
>empty(trudisp)

>this created the file name to be sent like 1234.txt.  C5 will not recognise
>the numbers and will give me a file named txt~1

>Any ideas greatly appreciated



Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
Marius

This is still a clarion file but glo:code=own:phone[4,7] &'.txt' is much
more elegant.

This C5 is tremendous - I loved 2003 but I am sure glad I went ahead and
upgraded.

Don

Quote:

>Hello Don,
>I noticed that you're using 'get(owner,1) which will work
>correct with a Clarion file. If it is a Topspeed file a SET/NEXT



Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
Arnor,
There is a small arithmetic mistake that we easily make.
The code 'glo:code= Own:Phone [X#-4 : X#] '
will return 5 characters. It should be it this example
 'glo:code= Own:Phone [X#-3 : X#] '
Regards,
Marius Luidens
Quote:

> >And I think you just pointed out my error, it should be sub 7,4 in that the
> >phone number also includes the area code 777 999 9999 in that I want to pick
> >up the last 4 digits of the number.

> How about:

> X# = Len(Clip(Own:Phone))
> glo:code= Own:Phone [X#-4 : X#] & '.txt'

> Best regards,

> Arnor Baldvinsson
> [Team Topspeed - Internet Connect]
> Allerup Edb
> Denmark

> http://www.icetips.com  (http://199.34.26.68)
> UIN nr.: 2428601



Sun, 29 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
hi Don,



Quote:
>You are right, CODE probably was a poor choice, will go back and change it
>and see what happens.

You are not using code, but glo:code which has nothing to do with
code.

Quote:
>And I think you just pointed out my error, it should be sub 7,4 in that the
>phone number also includes the area code 777 999 9999 in that I want to pick
>up the last 4 digits of the number.

How about:

X# = Len(Clip(Own:Phone))
glo:code= Own:Phone [X#-4 : X#] & '.txt'

Best regards,

Arnor Baldvinsson        
[Team Topspeed - Internet Connect]
Allerup Edb
Denmark

http://www.icetips.com  (http://199.34.26.68)
UIN nr.: 2428601



Mon, 30 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
Don,

    Just looking at this... you might consider grabbing the last four digits of
the string. That way all of the following would be good:

    312-555-1212
    (312) 444-1212
    3125551212
    555-1212
    5551212

    For that, I'd probably use string slicing... Something like...

    glo:Code = own:phone[ len(clip(own:phone)) - 3 : len(clip(own:phone))] &
'.txt'

    Just my two scents...

    Regards,

    kurtt

    Kurt Pawlikowski
    The Pinrod Corporation

    (773) 284-9500
    http://pinrod.com

Quote:

> Thanks everyone - Yep, I finally got it to working, but I am going back and
> change some of the code based on the suggestions.

> The owner file is just a one record file that contains the clinet's name,
> address, phones, etc.

> I developed this little program because all these truck companies fax their
> truck list and I am tired of retyping - get them to send this and it can
> just be sucked in (it's called the laziness factor)

> Thanks again



Mon, 30 Apr 2001 03:00:00 GMT  
 What am I doing wrong?
Hi Marius,

On Wed, 11 Nov 1998 21:55:05 -0400, Marius Luidens

Quote:

>There is a small arithmetic mistake that we easily make.

No need to be blunt - I do it every single time!<g>

Best regards,

Arnor Baldvinsson        
[Team Topspeed - Internet Connect]
Allerup Edb
Denmark

http://www.icetips.com  (http://199.34.26.68)
UIN nr.: 2428601



Tue, 01 May 2001 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. What am I doing wrong!

2. What am I doing wrong?

3. Stupid newb question: What am I doing wrong?

4. What am I doing Wrong

5. what am i doing wrong

6. Help - What am I doing wrong

7. Saving a Variable to a field in a record- what am i doing wrong

8. What am I doing wrong?

9. #CONTROL What am I doing wrong

10. What am i doing wrong.

11. What am I doing wrong?

12. Clarion 5.5 What am I doing wrong????

 

 
Powered by phpBB® Forum Software