jasongodoy Posted August 24, 2005 Posted August 24, 2005 Hey guys/gals, my situation is that I'm working with 2 files (file "1" and file "2". From file "1", I want to call on a field in file "2" which is auto-enter-serial and get the (TotalRecord Count). In file "1" I have a global called "grecord_counter" which I would like to set to the total records the of file "2". Then I have a field in file "1" to display the TotalRecordCount. I hope I didn't confuse you guys. Can someone show me how to set this up and possibly show my what I'm doing wrong? It seems so basic, but it's just not working out like I had planned. As it is set right now, the script steps I have read like this: Set Field[importer::grecord_counter; Categories::guidCategory = Get (TotalRecordCount)] Set Field[importer::total_record_field1; importer::grecord_counter *Categories is file "2" and importer is file "1"* Thanks in advance. J
Ender Posted August 24, 2005 Posted August 24, 2005 You may be making it harder than it needs to be. It may work better to use a cartesian join relationship to link the two files and count the records in file 2 through that relationship: Try adding a table occurence of file 2's table in the relationship graph of file 1. Then relate this to file 1's table occurrence with a cartesian join operator (that's the big "X" instead of the "="). Through this relationship, you can show the count of all the records in file 2 by using a Count() function over the relationship: Count(file 2::RecordID). *Categories is file "2" and importer is file "1"* Why didn't you just use their real names in the first place?? If you have hundreds of thousands of records in that Categories file, or you're running over a slow network and this count will be used on layouts, then a scripted approach may make sense. In that case you can do what you were trying by switching the layout to one based on the correct table occurence: # within the Importer file Go to Layout [ Some Categories layout ] Set Field[importer::grecord_counter; Categories::guidCategory = Get (TotalRecordCount)] Go to Layout [ original layout ] This means you would need to have a Categories table occurence in the Importer file and use that as a basis for a layout that this script would run in. Or you could put that Set Field[] in a subscript within the Categories file, and call it externally.
jasongodoy Posted August 24, 2005 Author Posted August 24, 2005 now every time I try to get the total amount of records, all i get is "0" when there are really "22". all my fields and contexts are correct as I've been over them 100 times. Any ideas? J
SlimJim Posted August 24, 2005 Posted August 24, 2005 Your SetField looks a bit odd. Set Field[importer::grecord_counter; Categories::guidCategory = Get (TotalRecordCount)] The only possible results of the calculation are 1 if Categories::guidCategory = Get(TotalRecordCount) and 0 otherwise. I can't believe this is what you want so what are you trying to do here or is there a copying error.
Ender Posted August 24, 2005 Posted August 24, 2005 Missed that one. It should be: # from a layout in Categories Set Field[importer::grecord_counter; Get (TotalRecordCount)]
jasongodoy Posted August 24, 2005 Author Posted August 24, 2005 Yeah, I just got it working. Finally!! Thanks guys for all your help! J
Recommended Posts
This topic is 7099 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now