I.T. Discussion Community!
-Collapse +Expand
Paradox
Search Paradox Group:

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

Prestwood eMagazine

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

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

howto display on form if rec exists in child table

howto display on form if rec exists in child table in Paradox Forms topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: display   howto display   howto display form   if rec   exists child  
philiptdotcom
-- USA

I'm trying to do something which would seem to be trivial, but something isn't working (or at least isn't working as I would expect).

Using Paradox 8 with all updates that I know of installed on updated Win7/64 Pro (as I have used for years).

I'm trying to display on a form as I move from one record to the next whether a particular child table has a corresponding record to the record in the tableframe on the form.

The form is for a tableframe populated by table TAXA.  PIERTAXA is a child table containing records that correspond (1:1) to some, but not all, parent records via fields in each table named TaxonCode.  I've created a field on the form with a calculated value:

iif([piertaxa.TaxonCode] = [TAXA.TaxonCode], "Yes", "No")

It works fine when there IS a corresponding record (field displays as "Yes"), but the field displays as blank (nothing displayed) when there is NOT a corresponding record.

Have also tried:

iif([piertaxa.TaxonCode] <> [TAXA.TaxonCode],  "No", "Yes")

Results are the same as first one.

Tried a couple of different field types (labeled, edit); nothing seems to work.

Tried adding conditional code to built-in methods (arrive, changeValue, newValue) to alter the value after initial display, but (likely obviously to those who know more about forms than I do) none of that worked (with msgs that I can't change the field value; even tried self.readonly=false before other code, etc.), but I'm not too worried about why this failed UNLESS there's a way that code on these methods can help.

Main question is "Why doesn't the code in the calc'd value work?"--or more practically, "How can I get around it not working?" (even if I don't know why it doesn't work).

Any insights/help would be appreciated!

Thanks! -pt

 Posted 34 months ago (Thread Starter)
Comment Quote
About philiptdotcom -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16970, 4 replies
Thread Started 1/13/2018 1:36:03 PM
View Counter=877
Last Reply Posted 1/15/2018 9:44:40 AM)
Location=-- USA 
Joined=15 years ago   MB Posts=17   KB Comments=2  
philiptdotcom
-- USA

Well, tried another approach to solve the problem in a slightly different (and, in this case, probably better) way and it WORKED.

I put this code on the newValue built-in method of the parent table's key field (in the tableframe):

var
stx string
endvar

dodefault

dmGet ("PIERTAXA", "TaxonCode", stx)

if stx = blank() then
self.font.color = "black"
else
self.font.color = "red"
endif

...and it serves the purpose (AND it behaved as I would have expected) by changing the font color to RED for those records with children.

Would still be curious to understand why the initial attempt (calculated value of the field) didn't work--if anyone just happens to know--but not particularly important any more.

Thanks!

Aloha,

-pt

 Posted 34 months ago (Thread Starter)
Comment Quote
About philiptdotcom -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16971 (Level 2) and Parent is 16970
Reply Posted 1/13/2018 1:59:50 PM
Location=-- USA 
Joined=15 years ago   MB Posts=17   KB Comments=2  
Moderator
Steven.G
Myrtle Beach, SC USA

it didn't work because the "isblank()" aspect wasn't part of it, and that's necessary with no records present.. or nrecords() = 0, or ccount([myfield]) = 0, etc

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 34 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16972 (Level 3) and Parent is 16970
Reply Posted 1/13/2018 2:40:49 PM
Location=Myrtle Beach, SC USA 
Joined=50 months ago   MB Posts=412  
philiptdotcom
-- USA

Steven,

Thanks for the quick reply!

I still don't really understand; what value (even null?) does the not-found linked table/record return?  i.e., what value does "[piertaxa.TaxonCode]" return, and why isn't this value <> to the value that "[TAXA.TaxonCode]" returns?

Aloha,

-pt

 Posted 34 months ago (Thread Starter)
Comment Quote
About philiptdotcom -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16973 (Level 4) and Parent is 16970
Reply Posted 1/13/2018 4:38:43 PM
Location=-- USA 
Joined=15 years ago   MB Posts=17   KB Comments=2  
Most Recent Post
Moderator
Steven.G
Myrtle Beach, SC USA

in many situations, an empty table can cause an error when you try to address it's field values, especially if you're in View mode and there isn't actually a record there.. it's more obvious when you scan an empty or filtered table

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 34 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #16974 (Level 5) and Parent is 16970
Reply Posted 1/15/2018 9:37:40 AM
Location=Myrtle Beach, SC USA 
Joined=50 months ago   MB Posts=412  

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 = P1287A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #16970 Counter
877
Since 1/13/2018

Follow PrestwoodBoards on: 


©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech