Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Right, I have been asked to start a new thread so here it is.

 

I am currently designing a solution for a horse livery yard for them to keep track of all the information for their horses.

 

I will attach a screenshot to hopefully help with this explanation.

 

1)   I am looking to display (in weeks) the difference between todays date and the last date entered in the relevant shoeing tab.

 

The same will be done with the tetanus and flu section as shown in the screenshot.

 

2)   Also, as shown in the other screenshot, I would like to have the horses name (to the record I am currently on) enter automatically in the horse name field. Now, I have created a relationship between this table and the main table so that when I enter the horses name in this field it will add the record to the main screen of the relevant horse but i would like this to be done automatically.

 

I know it really doesn't make any sense but hopefully the screenshots will explain it better than i can.

 

Thanks so much to everyone who helps,

Conor :)post-111022-0-81600300-1399288241_thumb.post-111022-0-07947500-1399288765_thumb.

Posted

On number 2 it sounds like you have a relationship between the two tables based on horse name. Highly recommend against this. In your main table you should have an auto entry serial number field. Your relationship should be based on this number. If you use horse name, what happens if you misspelled the name and then correct it. You would break all of the relationship. A serial number is something that you should never be allowed to change, so if you correct the horse name, the relationships would still be intact since you did not change the serial number.

Posted

Hi, Just checked on my solution and it doesn't seem to change anything when I have the relationship between horse name. I do have a Horse ID field which gets used elsewhere but when I use the horse name relationship and enter the horse name incorrectly it just doesn't add this record to the horses records. If i then go in and change the name it updates it and puts it where it should go.

 

Any idea on how I would achieve number 1? or does it need more explanation?

 

Thanks,

Conor :)


Also, Is there a way to have the horse name in the second screenshot automatically be inputted?

 

Kinda confused...

Posted

2)   Also, as shown in the other screenshot, I would like to have the horses name (to the record I am currently on) enter automatically in the horse name field. Now, I have created a relationship between this table and the main table so that when I enter the horses name in this field it will add the record to the main screen of the relevant horse but i would like this to be done automatically.

 

 

Please describe the tables you have and how they are related – “this table”, “main table” and “main screen” is only meaningful to someone who is familiar with your solution.

 

As to question #1:

 

You can do math with dates; e.g. Get ( CurrentDate ) - dateLastShoeing returns the number of days since that event (or until the event, if you scheduled a future date, or 0 if it is today).

Div ( result ; 7 ) returns the number of full weeks.

 

Since you have FM 13 Advanced, take a look at the Custom Function in the attached file; it calculates a textual representation of the difference (if there is one) between today and another date.

DateDifferenceInWeeksAndDaysCF_eos.fmp12.zip

Posted

That's great! The Get( CurrentDate) solution kinda worked. 

 

However, it only seems to show the difference between the first entry of the field and todays date. I need it to show the difference between the most recent entry of that field and todays date as that same field will have multiple entries.

 

I have attached a screenshot to hopefully help with this..

 

Thanks,

Conor :)


That's great! The Get( CurrentDate) solution kinda worked. 

 

However, it only seems to show the difference between the first entry of the field and todays date. I need it to show the difference between the most recent entry of that field and todays date as that same field will have multiple entries.

 

I have attached a screenshot to hopefully help with this..

 

Thanks,

Conor :)post-111022-0-36685900-1399297976_thumb.

Posted

However, it only seems to show the difference between the first entry of the field and todays date. 

 

This is (one of the reasons) why I asked you to describe your data structure (tables and their relationships). It's difficult to give detailed advice without this information.

 

as that same field will have multiple entries.

 

I think you mean: there will be multiple related records with a date?!

 

If the displayed portal display a relationship like Horses --< Events_Shoeing, then you need to use Max ( Events_Shoeing::date ) as function argument.

 

Note that this won't work (as easily) if you use portal filtering to display different event types in different portals that are all based on the same general Horses --< Events relationship.

 

(Again, without more background info that's mere conjecture.)

Posted

Ok, I have two tables that are involved in this specific area. A Horse Details table and another table for Shoeing that simply allows me to add dates that these events occurred.

 

Now, I know that I shouldn't create a relationship between names but that's what I have done because the Horse ID field just complicates things from my perspective.

 

I really can't explain it much better without sending you the actual solution... :/


Also, when I add a shoeing event it automatically shows up in the respective portal for that horses record... If that makes any sense.

Posted
I need it to show the difference between the most recent entry of that field and todays date

 

Assuming the entries in the Shoeing table are made chronologically, and that the relationship is not sorted, try something like =

Div ( Get ( CurrentDate ) - Last ( Shoeing::Date ) ; 7 )

.

 

 

 

Now, I know that I shouldn't create a relationship between names but that's what I have done because the Horse ID field just complicates things from my perspective.

 

Well, then perhaps you need to adjust your perspective ...

Posted

Ok, I am completely new to Filemaker and this is proving rather difficult.

 

Your solution must be wrong somewhere as it says there are too many parameters..

Posted

Hi guys. Another small query I have for you. I am calculating the difference in weeks between two dates which I have mastered. Although, I currently have a round function in the calculation but it's not very accurate.

 

Do you know of any function that if the period between two dates is less than a week, the answer is 0?

 

Thanks in advance!

Conor :)

Posted

If you need the number of whole weeks, check the Floor() function.

  • Like 1
Posted

If you need the number of whole weeks …

 

… use

Div ( differenceInDays ; 7 )

– which was suggested several times in the previous posts.  :logik:

Posted

In the horse business is it possible for two horses to have the same name? Matching by a name is almost always a bad idea since more than one person can have the same name, peoples names change and all. It just occurred to me that it's just possible that registered horses' names might have to be unique.

Posted

It just occurred to me that it's just possible that registered horses' names might have to be unique.

 

Even if they are unique, they might get misspelled.

Posted

Registered horses show names have to be unique, yes. Though, their yard names can be whatever the owner wants them to be so I guess I have a small problem there.

 

I did have it setup so that it is the Horse ID that I enter though that would mean I have to remember all of their ID's...

 

And, Comment, it isn't possible to misspell them as I have them enter into a list form layout and then use the list as a source for a drop down list so the user starts typing the name and the solution finishes it.

Posted

One more thing..

 

In order to decrease the chances of human error I want the Horse Name to be entered automatically in all the relevant layouts when I add a new record to them. I have tried creating a script to add to the Add button but haven't had much success...

 

I have attached a screenshot that probably won't help me in explaining this in any way but i'm gonna attach it anyway...

 

post-111022-0-12320400-1399622899_thumb.

Posted

I did have it setup so that it is the Horse ID that I enter though that would mean I have to remember all of their ID's...

 

No, that is definitely not how it works. You (the user) still work with the names of the horses. But behind the scenes it is the HorseID that links the horse to all its related records in the child table/s.

 

 

And, Comment, it isn't possible to misspell them as I have them enter into a list form layout and then use the list as a source for a drop down

 

It is possible to misspell them when you enter them into that list for the first time. And if you then use the misspelled name as the matchfield, you won't be able to correct the misspelling without breaking the links.

 

 

In order to decrease the chances of human error I want the Horse Name to be entered automatically in all the relevant layouts when I add a new record to them.

 

That's not quite clear. What are the "all the relevant layouts"? If they are layouts of the various child tables you have, you only need to place the HorseName field from the Horses table on the layout. Make sure to make it non-enterable in order to prevent accidental modification.

Posted

Ok, I will have another go at changing it to Horse ID.

 

I seem to be doing something wrong here if that's the case because it is still blank. I will try again.

Posted

Ok guys. I would appreciate your help with this one.

 

I am creating a custom dialog which will be used as a search dialog. I have looked at all the examples I can find on here and Google and they aren't quite what I need...

 

Also, I tried (If  Get (LastMessageChoice) = 2 then exit script but it just closes the dialog.

 

Any tips are greatly appreciated :)

 

Conor.

Posted

Also, I tried (If  Get (LastMessageChoice) = 2

 

You need to distinguish between the function If() – used in calculations – and the script step If[]. (My recommendation: Ignore If() and always use Case().)

 

The block inside If[] is entered depending on the Boolean result (True or False ) of the calculation you evaluate inside of it – so the syntax is 

If [ Get (LastMessageChoice) = 2 // an expression that evaluates to True or False ]
  # do something
Else
 # do something ... well, else!
End If

Here is a sample file with a number of search methods.

 

Maybe open a new thread for your next question? I think the last one was only remotely related to the original post.

SimpleSearchDialog_eos.fmp12.zip

Posted

Thanks! I'll check it out.

 

I just thought it was pointless opening up loads of new threads considering it is all related to the title... Creating a solution for iPad.. because I am, well, creating a solution that will be used on iPad.

Posted

I just thought it was pointless opening up loads of new threads considering it is all related to the title... Creating a solution for iPad.. because I am, well, creating a solution that will be used on iPad.

 

There are other people reading these posts, searching for a solution to their own problems. It is not helpful to have one huge thread dealing with an assortment of issues that have nothing in common except that you happened to run into them during the course of your project.

 

 

--

P.S. Please keep the above in mind when selecting the title for your thread, too.

  • Like 1

This topic is 3849 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
×
×
  • Create New...

Important Information

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