Variable not accepted

When I single step through the following procedure, I get to 'oldComment=Comment", the procedure steps next to the first line. When I close the procedure window, then run from the menubar, the supergettext accepts a new entry, but does not append the lComment variable to the Comment field. Why is it not working? (Comment is a text field. Panorama X Version 0.9.007 [2618])

local lComment,oldComment,lDate
lDate=datepattern(today(),"YYYYMMDD")
lComment=""
oldComment=Comment
showvariables  lDate,lComment,oldComment

supergettext lComment,{caption="Enter comment…" height=50% width=6in buttons="UseThis;Cancel"}

IF info("dialogtrigger") ="UseThis"
	showvariables  lComment
	field Comment
	cell lDate+" — "+lComment+¶+"---"+¶+oldComment
ENDIF

Is the button name really UseThis, with no space? If there is a space in the button title, your code won’t work.

Oh wait, the name of the button is UseThis with no space, so that isn’t the problem.

Well, I just tried your code, and it worked just fine for me. I did it several times and it appended just great. Well, actually it pre-pended, since that what you programmed it to do.

So I have no idea why this isn’t working for you.

This isn’t the problem, but I do have some thoughts about this code. I am wondering why you have this line:

showvariables lComment

Since this is a local variable, it cannot possibly be displayed anywhere. This line doesn’t really hurt anything, but I would take it out. Actually, I see another showvariables higher up, I think that should be removed also, again, it does nothing but cause a slight delay.

Also, is there any particular reason why you are using the cell statement? I think an assignment would be clearer.

Comment = lDate+" — "+lComment+¶+"---"+¶+oldComment

Back in the day, the Panorama macro recorder would record data entry using the cell statement, but usually I can’t think of any reason to use it now. However, the cell statement should work, I don’t think that is the reason for your problem.

Here is a revised/simplified version of your program. I also switched it to append the new comment on the end, since you said that was what you wanted. This code works for me, I hope it works for you.

let newComment = ""
supergettext newComment,{title="Enter new comment…" height=50% width=6in buttons="New Comment:120;Cancel:80"}
if info("dialogtrigger") match "Cancel" return endif
Comment = sandwich("",Comment,cr()+"---"+cr())+datepattern(today(),"YYYYMMDD")+" - "+newComment

If I replace:

field Comment
cell lDate+" — "+lComment+¶+"---"+¶+oldComment

with:

Comment= lDate+" — "+lComment+¶+"---"+¶+oldCommen

it works as expected. Looks like maybe there is a problem with the cell statement. I can’t get it to enter a value into a field using it directly on the active field.

That’s weird, I used Craig’s code exactly as he submitted it and it worked for me.

I tried this too, and I got the same results as Gary and Jim; your code worked perfectly for me and I was going to make the same suggestions for a revision. The only reason I’m chiming in is that some months ago I reported a problem with stepping through a procedure. I had the same sort of trouble with jumping back you reported. Subsequently I seem to remember that Jim fixed this, and today when I tried it, stepping worked fine for me. I’m using the latest Panx update.
Bill

I again just copied and pasted his code into a test database containing just a Comment field and it did not add the new values. I the used a simple cell "Ouch!" and again nothing. Don’t know why it works for you but I’m in High Sierra 10.13.1 - maybe that has changed something.

I don’t think Gary and I got the same results :frowning:

I tried

cell "Ouch"

and that worked perfectly, no problem at all.

I am not using High Sierra, but it’s pretty hard to imagine that that could make any difference. I looked up the code for the cell statement. In Panorama X, it is implemented using a custom statement, so the code actually being run is:

«» = parameter(1)
runfieldcalculations

So now I am really mystified.

I just quit and restarted Panorama X and it now works properly. Something must have gotten messed up along the way. I know I had to also recently restart Firefox because it was slowing down to a crawl. I’ve had my system running for several days now without restarting which I had never done in the past so anything is possible.

Sometimes I’ve left my system running for weeks. There was one point a few months ago when I was doing a lot of work on the Panorama Help system that I had Panorama X running for two weeks without ever quitting once (that’s a bit unusual for me since I normally have to relaunch Panorama X every time I make a change in Xcode, but I didn’t make any changes in Xcode during that period.)