Help ... I have been away from Clarion for many years

I am trying to build an application in C8 and am having trouble with a bit of code. I have a data file with the following:
Unique user ID
Date
SessionNumber

the Session numbers represent 1 hour time slots from 9am - 5pm. Simple enough so far … here’s where the trouble starts:
I want the Update form to present time slots as buttons as such:
image

I want to hide a button if it is already selected in either the current record or in another record with the same date. Current record is no problem, but it seems like I cannot scan the data file by first priming the date of interest and doing a SET/NEXT set of steps. The data form will work for the first time I open it and close it. It however, will not operate correctly the second time the Update procedure is called.

Any ideas of what may be going on? I have tried this from a number of EMBEDS with no luck. I have even tried saving the Date/Session record data in GLO variables in the BROWSE EMBED when a RECORD is SELECTED.

I am lost …

p.s. C8 seems to be very buggy. I am trying to get TS to remind me of what my C6 serial number is. Lost in retirement and moves.

thanks all

Mark Parsons

I should have said that a small snippet of EMBED code sets the Session number based on what button is pressed. that works fine.

Hi,
Why don’t you post the actual file definition and some code showing how you’ve tried to tackle this?

Yeah, C8 is not the best. It’s got way better.
So I’m assuming your file layout has Date, Machine, Slot as a key.
So I’d create an Alias of that file to look up stuff. otherwise you’re stuffing up the current buffer.
In the .init method, I’d then use that alias to attempt to fetch each slot and set the disable state of the button accordingly.

Oftentimes, the problem is that the window has not yet been opened. Have you tried using the Embeditor and search for “SELF.Open(Window)”. Most likely, you’d want your code somewhere below that.

Thank you all for the responses. I have decided to drop back to an earlier backup and finally got things to work.

I have used Clarion since the CPD 2.1 days but never really picked up OOP programming. I understand the concept but found the EMBED points to be alien in their descriptions and never quite understood the structure of the generated code. I built a workable understanding of template generated code (nowhere near expert) by reviewing the CLW files back in the DOS days and that served me well. I just couldn’t crack the OOP thing.

I have built some fairly complex apps in C6 in the past and am trying to get back into it with this (what should be) simple app.

I am now trying to get TopSpeed to remind me of what my C6 serial number was because I am finding C8 to be unstable. I was very comfortable with C6.

thanks again

Mark

If you’re in the mood for some gentle hand-holding looking at the basics of Clarion OOP, check out Bruce’s Oldie-But-Goodie book: CapeSoft ABC Book

1 Like

thanks for the tip Jane!

sure. It was unstable then, and is now. (better than C7.)
After that came C9, 9.1, C10, C11, C11.1 and each have had lots of bug fixes, and improvements, especially in the IDE. C8 must be over 10 years old now, and it was a “version 2” of the IDE back then, so I’m not sure I’d recommend it for any serious work today.

Understanding the generated code is a key step in being able to embed your own code. I strongly recommend always writing embed code “in context” so you can see the code being generated around it.

OPP is a funny concept - it’s not hard at all, but it’s a binary moment when you “get it”. Once you “get it” it’s easy to understand, and trivial to follow the code. It takes 5 minutes to learn - but it might take 6 months of hearing the same thing to get to that 5 minute moment. Up to that point it’s difficult to figure out what is going on. I wrote the book, and did the training courses back in the late 90’s, early 2000’s based on my own “5 minute moment” in hopes that it would be useful to others. I like to think maybe it was.

Bruce

1 Like

Jane, great recommendation. Just completed a 30 APP legacy to ABC conversion and his book was a great help in understanding where to put things and what file functions would need to be addressed. Any legacy user wanting to understand OOP should consider this required reading.

Bruce, I have been a mostly legacy coder in Clarion all the way back to their DAT file days. I was faced with converting a 30 APP C10 legacy application to ABC and found your book in my library from some DevCon purchase in the past. I want to tell you re-reading it was not only essential to me grocking ABC but knowing what embeds and file functions I would need to address. Thanks so much for the time you put into that book. That said, I don’t think I would ever want to do such a conversion again. JoeS

thanks for the kind words Joe.

When ABC first came out in 1997, Clarion Legacy apps had had a max of 3 years of development by that point. Let’s call it 3-5 years by the time most folk started converting in the early 2000’s.

By contrast, Legacy apps today have 20+ years of development behind them. They are consequentially a LOT bigger. So one can figure on at least 5 times the work - probably more - to do it now.

So I think those of us who bit the bullet early scored in the sense that it was a much smaller task. I think for large apps now, conversions are unlikely. They’re just too big and too mature.

1 Like

Just see if you can try to put in your code at open window embed.

Your problem is likely that you are not using an alias. When you open a form that record will be in the file’s buffer. If, after opening the form, you do a set/next through a bunch of records in the same table, you make your form very unhappy; both the values in in the file’s buffer change, plus the “active” record in the table. So you have to do your set/next using an alias table. That way your form keeps the same record it started with, but you still collect the data you want.

1 Like

a set/next through a bunch of records in the same table can be wraped by SetFile/RestoreFile pair.

thanks you all for the advice. I have decided to restructure the data file contents and retions to make life a bit easier.

I had tried the Alias file approach, but got nowhere (probably my lack of understanding on how to implement). The GetState/RestoreState approach looks promising… I wish I had seen it before I turn the files upside down!!