IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

December Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardParadox Forms Topic   Print This     

Custom method call in a calculated field

Custom method call in a calculated field in Paradox Forms topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: calculated   Custom method   Custom method call   calculated field  
Gary.L3
-- --

Can someone please help with this?

In Corel Paradox 8, I have a custom method that returns a string that I want to display in the field value box.   However the only thing that displays is ERROR.   The help menus say that the method has to be in the "RSL runtime library." My method was attached at the form level.   Any help would be appreciated.

 Posted 8 years ago (Thread Starter)
Comment Quote
About Gary.L3 -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #15034, 11 replies
Thread Started 6/20/2013 5:06:40 PM
View Counter=3473
Last Reply Posted 7/6/2013 7:35:44 AM)
Location=-- -- 
Joined=8 years ago   MB Posts=8  
Gary.L3
-- --

I should add that I just put the name of the method [e.g., custommethod()] in the define field- calculated entry box

 Posted 8 years ago (Thread Starter)
Comment Quote
About Gary.L3 -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #15035 (Level 2) and Parent is 15034
Reply Posted 6/20/2013 5:13:48 PM
Location=-- -- 
Joined=8 years ago   MB Posts=8  
Daniel Fought
Prestwood IT
Home office in Fresno, CA.

Is this a report or a form?

Dan Fought
Senior Programmer Analyst
Prestwood IT Solutions
http://www.prestwood.com

 Posted 8 years ago
Comment Quote
About Daniel Fought -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Daniel Fought
Danial Fought is a senior programmer analyst with Prestwood IT where he develops custom Windows software and custom websites. When Dan is not coding for clients, he participates in this online community. Coding specialties include Paradox/ObjectPAL, MS Access, Visual Basic, and VS.Net/VB.Net.

Post ID #15036 (Level 3) and Parent is 15034
Reply Posted 6/21/2013 5:34:33 AM
Location=Home office in Fresno, CA. 
Joined=19 years ago   MB Posts=401   KB Posts=12   KB Comments=4  
Anonymous Post

A form

---
Gary
 Posted 8 years ago
Comment Quote

Post ID #15037 (Level 4) and Parent is 15034
Reply Posted 6/21/2013 6:10:00 AM
Anonymous Post

The ObjectPAL help reference says that the following can be used in a calculated field:

custom methods attached to other objects or to the field itself (you must declare a UIObject variable within the scope of the calculated field and use an attach statement to associate the variable with a UIObject).

Element:  uio.objCustomMethod() 

Comments: custom method attached to another object (must return a value)

If I could only figure out how to do this, I'd get what I need.

Any help would be appreciated

---
Gary
 Posted 8 years ago
Comment Quote

Post ID #15038 (Level 5) and Parent is 15034
Reply Posted 6/25/2013 6:16:21 AM
AIBreveleri

In the help text for "Using ObjectPAL in calculated fields", the fifth bullet item is:

"- Custom methods attached to other objects (or to the field itself). You must first declare a UIObject variable within the scope of the calculated field and use an attach statement to associate the variable with a UIObject."

This is wrong as it stands. The text should read something like:

"- Custom methods attached to other objects (or to the field itself). The object that the method is attached to must either be within the scope of the calculated field, or referenced by a UIObject variable that is within the scope of the calculated field.

Objects within the scope of the field include any object in the field's container hierarchy, or any fully named object on the same form or report.

For objects outside the scope of the field, you must first declare a UIObject variable within the scope of the calculated field and use an attach statement to associate the variable with a UIObject. The attach statement must be placed in a location where both the UIObject variable and the object to be referenced are within its scope."

In other words, if the method is on the form, just refer to the object and its method directly.

-Al.


 Posted 8 years ago
Comment Quote
About AIBreveleri -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #15043 (Level 6) and Parent is 15034
Reply Posted 7/3/2013 9:31:00 PM
Location= 
Joined=20 years ago   MB Posts=286   KB Comments=8  
Anonymous Post

I'm still not getting it. Sorry.

I have a form with a one-to-many data model.  I want to put a calculated field on the form that calls a custom method.  The custom method "peeks" into the "many" table and creates a string showing the values of a certain field across the many records in that table.  The custom method returns that string.  In the calculated field box where I put the code, I call mCustomMethod().  The custom method is attached to the calculated field.  I get "<Error>" as the calculated value.

If youi could give me an example of the UI code and where to put it, I'd appreciate it.

Thanks.

---
Gary
 Posted 8 years ago
Comment Quote

Post ID #15044 (Level 7) and Parent is 15034
Reply Posted 7/5/2013 6:06:50 AM
Daniel Fought
Prestwood IT
Home office in Fresno, CA.

You might want to determine if the problem is in your custom method or in the calculated field.  Try a very simple custom method that returns a string like "Test".  Call that in your calculated field.  If it works then something is amiss with the value that your custom method is returning.  At least you will have determined if how you are calling the custom method is correct.

Dan Fought
Senior Programmer Analyst
Prestwood IT Solutions
http://www.prestwood.com

 Posted 8 years ago
Comment Quote
About Daniel Fought -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Daniel Fought
Danial Fought is a senior programmer analyst with Prestwood IT where he develops custom Windows software and custom websites. When Dan is not coding for clients, he participates in this online community. Coding specialties include Paradox/ObjectPAL, MS Access, Visual Basic, and VS.Net/VB.Net.

Post ID #15045 (Level 8) and Parent is 15034
Reply Posted 7/5/2013 7:12:45 AM
Location=Home office in Fresno, CA. 
Joined=19 years ago   MB Posts=401   KB Posts=12   KB Comments=4  
AIBreveleri

In addition to the experiment that Dan suggests, you might try this:

Place a button on the form, in the same physical context as the calculated field.  (That is, if the field is on the bare form, put the button on the bare form; if the field is in a MRO, squeeze the button into the same MRO, etc.)  Then add this to the PushButton() event:

msginfo( "Peek into Many", CalculatedField.mCustomMethod() )

Dan's suggestion will tell you if you're even executing your custom method.  The button test will tell you what it is calculating.

-Al.

 Posted 8 years ago
Comment Quote
About AIBreveleri -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #15046 (Level 9) and Parent is 15034
Reply Posted 7/5/2013 7:24:27 AM
Location= 
Joined=20 years ago   MB Posts=286   KB Comments=8  
Anonymous Post

Both tests worked.  So, I changed the code in the custom method I made for the test to reflect my actual code.  I did not get an error!  When the form runs, it returns the proper value for the first record.  When I advance to subsequent records, it does not refresh with the new values.  Thoughts?

---
Gary
 Posted 8 years ago
Comment Quote

Post ID #15047 (Level 10) and Parent is 15034
Reply Posted 7/5/2013 8:01:21 AM
Anonymous Post

With the button press, I see that my method is returning the right value on each record.

By tracking, however, I have determined that the custom method is not being called when moving from record to record.  In the define field dialog box, I tried calling the method 2 ways:  CustomMethod() and Field.CustomMethod().  Neither works.

---
Gary
 Posted 8 years ago
Comment Quote

Post ID #15048 (Level 11) and Parent is 15034
Reply Posted 7/5/2013 8:21:18 AM
Most Recent Post
AIBreveleri

You must add code to refresh the field whenever the record changes.

Paradox does this automatically for any objects that have been bound to (defined with) columns in the data model.  If you just plunk a field down on the form without defining its data source, it remains completely ignorant of any record changes or other data navigation events.

I think you may be using the wrong technique to display the data you want to see.  Can you explain what you are trying to do?

-Al.

 Posted 8 years ago
Comment Quote
About AIBreveleri -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #15049 (Level 12) and Parent is 15034
Reply Posted 7/6/2013 5:44:44 AM
Location= 
Joined=20 years ago   MB Posts=286   KB Comments=8  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P195A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #15034 Counter
3473
Since 6/20/2013
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2021 Prestwood IT Solutions.   [Security & Privacy]