File COPY

Can someone please explain me the copy function. I used it like the example in the help file but it gives me a compile error about type conversion COPY(‘c:\dummy.txt’,‘c\navidum.txt’); Whats wrong Thanks for helping

The way you use the COPY function is correct. It should work like this. Is there any code before you call this function? If so, check if you didn’t forget a puntkomma(; … what’s that in English), somewhere. Anolis Sittard Netherlands

We use the following test code IF COPY(‘c:\dummy.txt’,‘c:\navidum.txt’) THEN MESSAGE(‘hoera’); Then at compile the following error in ‘dutch’: Typeconversie is niet mogelijk omdat een van de zijden van een niet toegestaan type is. Record := Text Eric

I tried your code, and a happy ‘hoera’ appeared on the screen. What happens if you remove the copy function, do you still get an error or not? Anolis Sittard Netherlands

We use this in a form at a command button, at OnPush() the following gives no problem IF TRUE THEN MESSAGE(‘hoera’); We are using version 2.01 could this make a difference?

Hmm, I am using Version NL 2.01.B . I don’t think that’s the cause of the problem. It’s very mysterious. Sometinmes you’ll get a simular compiler error when you ommit some brackets when you use IF … AND … . I don’t know what it has to do with the COPY function, but you could try: (COPY(‘c:\exc.txt’,‘c:\HIERO.txt’)) …I don’t think it will work, since your original code works fine when I try it. Maybe anyone else experienced this problem? Anolis Sittard Netherlands

It sounds like the compiler is expecting a record variable for the COPY command. Note there are 2 COPY commands: Record.COPY(FromRecord) and Ok := File.COPY(FromName,ToName) I guess you have some more code in your trigger, probably something like: WITH myRecord DO this would cause the compiler to think it was the Record.COPY you are trying to accomplish. Best regards, Soren Nielsen, moderator Navision Online User Group Edited by - SNielsen on 2001 Mar 21 12:45:35

Yes, that is the problem. Is there a way to explain the compiler that it’s not a record copy?

Yes: FILE.COPY(‘c:\dummy.txt’,‘c\navidum.txt’); That’s all. Anolis Sittard Netherlands

Problem solved Thanks for all the tips