Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entry Locator

Status
Not open for further replies.

wchestnut

Programmer
Aug 9, 2010
79
US
First, just to let you know, I'm a very intermediate Clarion 5 user. I've been modifying existing code of an old application and trying to create a new Sales module off of the existing application. So I understand the very basics and certainly am not an advanced user.

I'm trying to copy everything from one Browse object in one application to another. I wish it could be as simple as copying everything from the original Module into a new one in the newer application and it would re-created it identically, but that doesn't seem to work. So I'v been trying to duplicate every property in the original application and I hit a roadblock.

In this Browse window, I'm trying to filter out records in the queue by a File Relationship. Basically, a Contacts Update window is open and the user clicks on a Comments button to open all comments related to only that contact.

On this Comments Browse window, the "Locator" value in List Properties, Default Behavior is set to "Entry" in the original application.

Upon compiling the new program, I get a message in the Error Editor:

Template Error in Procedure: BrowseCommmentsSales
A Entry locator was specified, but no entry control
exists for the free key element! Using STEP locator
Browse Condition: Default Browse Behavior
Current Key: CMT:NameDateID
Locator Type: Entry
Range Field: CMT:CCID

I think I understand what it's complaining about but cannot seem to find the "entry control" anywhere. Where would this be set?

Please let me know if I need to post more information. Thanks!
 
Hi!

If the Browse uses a ENTRY locator, it expects you link it to an Entry control present in the window. If there is no Entry control, you can change the Locator Type to STEP or INCREMENTAL. Or, if you want to use a Entry locator only, define a local variable of similar type to the first free key element of the key CMT:NameDateID i.e. the column after CMT:CCID in that key. Populate that local variable on the window as a Entry Control and link that to the browse.

Your choice.

Regards
 
Hey, ShankarJ! Long time no type to.

Until now, I couldn't figure out how to get the related Comment records from the Contact to load in the Browse -- no records would appear even though I had the correct Default Behavior parameters set.

After banging my head on my desk for the past couple of hours, I figured out the problem and fixed it and it wasn't even related to ENTRY or STEP -- which I thought it was (i.e. setting the Location or record pointer). I ended up unchecking the "Initiate Thread" on the frigging button that launched the browse!

I'm assuming when that's checked, it's creating a new reference to the CONTACT table where the record pointer is not set to the same record as the previous browse window -- or something like that.

Thanks for jumping in and trying to help. I'm sure I'll be back!
 
Hi!

If your table is marked as THREADED, than a separate instance & record buffer is created for each thread which have no relation to each other. So, if you are using START to start a procedure in a new thread, you need to pass the parameters (STRINGs - max of 3) along with it so that you can retrieve the correct record in the new thread. For example, START(CommentBrowse, ContactID) and in CommentBrowse use the passed parameter to retrieve the Contact Record before the Browse is init'd.

Regards
 
Interesting... I just checked the Properties of the CONTACT table in the Dictionary and there's a checked box called "Open in current thread". Even though I had "Initiate Thread" checked on the button that launched the Browse with the CONTACT table included in the File list, shouldn't that have allowed access in the current thread and record buffer?

This is related to another problem I'm having. They created a login system with a user table in the original app. After logging in, it appears the record pointer in the user table is set and called upon to check security level and automatic browse filters.

I tried re-using Exported code from the original app, but the button I create has to have "Initiate Thread" checked or it craps out during runtime. The re-used code must be referring to another instance and record buffer because the logged in user's initials are not appearing. So, I've been having to re-create the procedures manually -- which is a pain with all of the Data varaibles and Embeds.

Is there any way I can either pass on a variable to the Exported code, or easily re-create a new copy of a procedure?
 
Hi!

"Open in current thread" add a THREAD attribute to the FILE definition which means the same Table across threads are NOT related i.e. separate record buffers, separate internal pointers, etc. When the thread is launched from the button a new instance of the CONTACT table is opened and all pointers are reset and buffers cleared. So, pass the Contact ID as a parameter to the called procedure which can then retrieve the Contact record again.

Assuming that the User record will be always available is dicey. What I do is copy the relevant User columns into Global variables after a successful login and after that I refer to the global variables only.

What do you mean by exported code?

The reason the procedure craps out during runtime is because you have the MDI Child attribute setup in that procedure's window. Don't you have an Application MDI Frame as the first procedure of the application?

Regards
 
Boy, most of that just flew over my head! :)

Yes, even thought I barely know Clarion, I was surprised the original developer didn't use a Global Variable instead of referring to the user table. They seemed to know their Clarion stuff, but I would have used a Global Variable instead.

I refer "Exported code" as those procedures in the original app which have the "Export Procedure" checked under Procedure Properties and "[Export]" is appended to the name of the procedure in the list. My assumption is that feature allows the procedure to be called by another app.

When I select "Initiate Thread" in the new app to call a procedure from the old one, the Parameters field is disabled.

I believe the answer is "yes" to your Application MDI Frame question (menu) so I'm not sure why MDI Child is selected on that table. So if I uncheck that, recomplile the original app, would I then be able to call it from the button without "Initate Thread"?
 
Hi!

If procedures are STARTed from the MDI frame i.e. opened in a new thread, then these procedures should have their window marked as MDI Child.

Unluckily, Clarion 5 templates did not provide for parameters while calling procedures in a new thread. You can bypass that limitation by either using non-threaded Global variables OR using the source embed and calling the procedure manually in code.

The choice to EXPORT procedures is ONLY available if you are generating a DLL/LIB as opposed to the normal EXE while compiling the application. Only Exported procedures can be called in other applications.

Is the original application a MULTI-DLL solution i.e. One EXE and multiple DLLs? And, is your application a Single EXE solution?

Regards
 
Yes. There is one "master" EXE (ITSYS.EXE), 5 DLL sub-components (BROWSEAI.DLL, BROWSEJZ.DLL, CONTACT.DLL, DATA.DLL, REPORT.DLL) and 4 other EXE sub-components (PROFIT.EXE, USERS.EXE, OUTLOOK.EXE and my SALES.EXE) -- all feeding off the same set of tables. Fun, eh?

I think I could try to implement your workaround suggestion of using Global Variables -- at least for the few old procedures I need to try and re-use instead of re-create.

Thanks! I'll keep you posted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top