Jump to content

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

Recommended Posts

Posted

what I'm looking to do is this.

I have field "Finished" which is looking at a vlaue list of yes, no, and maybe. What I want to do is to have two other fields to be filled in with the current date and time when a value is selected in the "Finished" field, no matter what value is picked. Otherwise I want the date and time fields to remain empty.

This is in FMP 6!

Thanks alot

Posted

If you format the field as a menu (versus as a list) and set it to not allow entry, then you can use this old trick. Create a script something like

Go to Field [Finished]

Pause/Resume Script [0:00:00]

If [not IsEmpty(Finished)]

Set Field [yourdate, Status(CurrentDate)]

Set Field [yourtime, Status(CurrentTime)]

End If

and attach it to the field by specifying the field as a button in Layout Mode, selecting Perform Script, and then specifying this script. Since you cannot tab into the field, you have to click the button to access it, which initiates the script, pauses, and continues once an option has been selected or you've clicked outside of the field. For this reason, you may want to set a global text field with the current data in the field and test that it has indeed changed afterward, with If [globalText <> Finished] instead of [not IsEmpty(Finished)].

Posted

Heya thanks Queue, but I'm having a little trouble with this. I pretty much followed what you wrote exactly. The script seems to make sense to me and I put it in jsut as you have above. Here's what's happening

I click on the "finished" field button and I immediately see the command and . symbol showing a script is running and it pauses. BUT, it does not bring up the field options until after I unpause the script. Meaning, I dont get the option the select a value in the field "finished" until the script is unpaused, and thus finished. So it leaves the date and time field emtpy. Unless I click on the "finished" button again, then since it now has a value the date and time do correctly get entered.

just to clarify. even though in the script I have go to field["Finished"] on the line directly above Pause/Resume Script ["0:00:00"], script is exactly as above, it is still pausing before I get a chance to pick a value from the list.

I have tried formatting the field as a pop-up menu and as a pop-up list.. but have had the same problem with both. any ideas?

Posted

Hey thanks for the response Steve, but I still cant get it to work. After entering in your line there is a change, but now when I hit the button, nothing seems to happen. This is while formated as a popup menu. When formated as a popup list, I click the button and see the list of values flash quickly. There is no opportunity to select one of the values and then the script is done.

Here is what my script looks like now.

Go to Field ["Finished"]

Pause/Resume Script ["0:00:00"]

Exit Record/Request

If ["not isEmpty(Finished)"]

Set Field ["Date","Status(CurrentDate)"]

Set Field ["Time","Status(CurrentTime)"]

End If

I have removed the Exit Record/Request as I'm not really sure of the logic of it there, and it's just not working. Any further help would be much appreciated.

Posted

just noticing something else. On the status bar on the left, when I click the button, I see the script "continue" "cancel" buttons flash for a sec then they are gone. Is it possible that pause script is indeed waiting for 0 seconds and not for user interaction? Or maybe something about entering a popup field is messing it up? I dunno. Thanks again for help so far you guys.

Posted

If formatted as a menu, that shouldn't happen. Are you on Windows or Mac? That might be the issue in the Pause/Resume. It works fine on Windows.

Posted

Im on a mac. I dunno. maybe it is an issue with the Pause/Resume. Thats a real bummer, cause it would be really sweet to make it work. I mean, I can always have a button that you click to fill in the current date and time, but man.. that stinks!

Anyone else have any ideas?

Thanks again Q for helping out

Posted

I believe on a Mac that using a loop like

Loop

Go to Field [Finished]

Pause/Resume Script [0:00:01]

Exit Loop If [Length(Finished)]

End Loop

works. But a Mac user will have to verify that.

Posted

well I tried out the loop and it acts the same way as the other script, only deifference here is the 1 second delay before I can pick a value from the menu.. for some reason it jsut wants to pause before I have the option to select the value fro the field.. I dunno.. thanks again for another shot at it.

Posted

Remove the duration from the Pause/Resume Script step

Instead of

Pause/Resume Script [0:00:00]

use

Pause/Resume Script[]

Should work just fine formatted as a pop-up list or pop-up menu.

The attached file does what you wanted, I think.

date&time.fp5.zip

Posted

Does this work on Mac? On Windows it won't resume until you press Enter; clicking a menu/list option has no effect. That's the reason for the duration.

I know there's a sample around here somewhere that deals with a looping script for Mac.

Posted

You are right, it only does work after you press enter or click the continue button, but it does work.

I should stick to asking the questions instead of butting in trying to answere them, but as I ran into a similar situation recently which was corrected by removing the duration in the Pause/Resume Script step, I thought it might help here.

Seems to me that the Pause/Resume Script works just like it is defined; if there is a specified duration time it will wait for that time and then continue regards of user input or interaction, else if there is no specified duration time, it will wait for user interaction before resuming.

Posted

On Windows a drop-down menu will pause until the user has made a selection or clicked out of the field, if you use the duration. I'm fairly certain the Mac version used a loop and a pop-up list. I'm just waiting for Lee or LaRetta to clear things up here. laugh.gif

If you have to click Continue or press Enter, then the script is definitely not set up correctly.

Posted

ROTFLMAO

Thanks a lot JT,

IMHO, the looping script approach is ugly.

Why not use a Text Plunin instead?

On the Mac, there must be text in the field before it will exit the loop. If there is no Data, it will flash it's ugly head off.

HTH

Lee

Posted

It blows if you have to use a text plug-in on Mac but not Windows. But if it's the best option, I guess I'll give up on trying to find the nifty cross-platform script. I'll just take my XP and go home. tongue.gif

Posted

That all seems very complicated. What's wrong with -

TimeChanged = Status(CurrentTime) * not IsEmpty(Finished)

and ditto for date?

Posted

Hi,

A list would be activated by The GoToField script :

- if formatted as a Pop-Up List on Macs

- if formatted as DropDown Menu List on Windows.

So the best option, if you want it to be X-Platform, would be to :

1. Create a copy of your 'Finished' field in Layout Mode

2. Format one with Pop-Up and the Other with DropDown Menu

3. Correct the Tab Order so that the Pop-Up is ordered prior to the Menu

4. Place the Menu on Top of the Pop-Up

5. Use a script step "Next Field" according to the Platform

The whole script would look something like.

SetField[Finished,""]

GoToField[Finished]

If [Abs(Status(CurrentPlatform)>1]

NextField

EndIf

Loop

EndLoop If [not Is Empty(Finished) or not Status(CurrentFieldName)= "Finished"]

Pause/Resume Script [00:00:01]

End Loop

If[Not IsEmpty(Finished)]

SetField[Time, Status(CurrentTime)]

SetField[Hour, Status(CurrentHour)]

EndIf

ExitRecord

testfininished.fp5.zip

Posted

well. I come back from a few days off and lookie here. thanks all for the responses. I'm sorry to say that I still do nit have this working... that last post by Ugo is.. well.. I dont get it. I had it formated as a popup list to begin with.. but I tried the script and it doesnt work right..

I tried to make the calculation field like Oldfogey suggested, but it doesnt equate to the current date. It's either a ? or some crazy date that is obviously result of an unintended calculation. Maybe I misunderstood the intent of that

TimeChanged = Status(CurrentTime) * not IsEmpty(Finished)

Sorry guys. I've never been good with the scripting stuff. But thanks alot for all the help

Posted

TimeChanged shouldn't equal the current date; it should equal the last time changed. TimeChanged is simply the name of the calculation field whose formula is Status(CurrentTime) * not IsEmpty(Finished). You'll want to use Case( not IsEmpty(Finished), Status(CurrentTime) ). For the DateChanged, use Case( not IsEmpty(Finished), Status(CurrentDate) ).

Posted

Lee, does it flash for you when the Pause/Resume is set to 1 second versus zero?

Posted

JT,

I used 01, not 00 because that was what you wanted tested. However, changing it to 00 does not change anything.

I hope we're talking about the same thing, because I'm referring to the flashing in the Menu that is caused by a looping script.

Lee

Posted

Hi JT! I believe you are thinking of Ray's demos, several of which use the process and I have duplicated within some of my demos. You are missing an Exit Record Request[ ], Ugo. wink.gif

To see it in action ... check out Popup Layout Menu . Everything must be right (stacking order, tab order and script lines) or it won't work right. But when one has it right, it works like a charm although I can only verify on windows machines. And always leave User Abort off until you are sure it's right. It doesn't flash at all on Windows, Lee ... not sure if it does on a Mac - maybe you could check the differences. smile.gif

Posted

Hi LatRetta,

Ray's demo flashes in the same manner as the two scripts I have been testing.

frown.gif

This topic is 7519 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.