Jump to content

calculation


This topic is 5708 days old. Please don't post here. Open a new topic instead.

Recommended Posts

i made a calculation for a field and the output is text, when i try to search, it does not see the files prior to the modification of the calculation only the new records after modification,any remedy?

the attached zip file has the field Mont_year calculation, and it generates 06 (for the year) 00 for the month and 3 digits for the records newly entered.

any modification to the calculation it gets blind to the prior records when searching.

hello.zip

Link to comment
Share on other sites

Change the calc to unstored. Or alternatively, do a replace of one of the fields referenced in the calculation (click in the field, (MENU) Record --> Replace field contents) and for the replace, choose calculated result and simply select the same field your replacing your contents in.

This replace should force a re-evaluation of all stored calculations that reference this field somewhere.

**Make a backup of your file before you attempt this.

~Genx

Link to comment
Share on other sites

You can also force a reindex just by changing to unstored, exiting from Define Fields, going back in and indexing again. This is usually quicker than Replace Field Contents because you don't have to find/create a layout with the field on it. :wink2:

Link to comment
Share on other sites

Auto-entered calculations only evaluate when a record is first created, unless you specify otherwise by deselecting the 'do not replace' checkbox, which in this case you would not wish to do. Nor do you want to run a Replace using the same calculation to update the field, unless you want all similar records to contain the same result (since the calculation relies on Count() and would produce 17 records with a value of 06-10017, among others). Instead, run a Replace using a calculation only involving the current contents of the field, namely

Left( CASE #, 2 ) & "-" & Right( CASE #, 5 )

Link to comment
Share on other sites

Hi JT,

I admit I didn't even check the file ... I thought it was a simple reindex issue to bring fields up to snuff. But even an empty field can be turned into an indexed calc ... then changed back to a standard field - and FILL THE FIELDS!! I do it all the time and it's simpler than loop/setting the fields with data or Replace Field Contents.

Well ... nonetheless, I should have paid close attention to the post and the file before responding. I know better than that ... :wink2:

LaRetta

Link to comment
Share on other sites

That is true, but depending on the number of records in the file, it would seem that running a Replace could be much faster than changing the indexing on a field and then waiting for it to reindex after changing it back. Then again, I do not own 8, so it may be completely different than I envision.

By the way, I had not read either response before posting my own. So I was not attacking what anyone else wrote, merely explaining why some other options may not be suitable in this case.

Link to comment
Share on other sites

thx for the response,

i tried to go to (case #) in the browse mode, record from Menu replace with calculation, which is

Month_year & Right("000" & (Count(Self_On_Month_Year::Date));3)

hit replace, back to search mode and am able to retreive 2 records from 37.

in search in field case # i put 06 to get all records in 2006 as per calc.

please tellme if i am doing somthing wrong.

Link to comment
Share on other sites

That is exactly what I said not to do. Now you will only have 3 unique values for the field, which is no good.

Go back to a copy of the file saved before you made the change and use the Replace calculation I posted above instead of the auto-enter one.

Link to comment
Share on other sites

i appreciate being patient with me because am new to this. i added a new record without calculation 0604011, now i have 36 records, then went to field in browse mode clicked it went to records from menu pulled replace field contents>>from calculation>>specify>>refered to your string so i typed Left( CASE #, 2 ) & "-" & Right( CASE #, 5 )in the field >>hit replace>>surely my 0604011 turns into 06-04011, go to search mode enter 06 to pull all files starting 06>>>>well...i get 13 from 38 starting 06-.....

Link to comment
Share on other sites

Your index may be corrupt. Change it to something else (such as Unicode) in the Storage options for the field. Close the Define Database window, then open it and change the indexing back to what it was originally. Then try performing your find.

Link to comment
Share on other sites

This topic is 5708 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.