Jump to content
Salesforce and other SMB Solutions are coming soon. ×

scripting a find


kareng

Recommended Posts

I have a script written to preform a find of a date entered by the user. They can put one date or a date range (separated by ...) Some of the users requested not having to do the ... to separate the range of dates. Is there a way around that? I tried making two separate fields - date one and date two and writing a calculation that takes date one & "..." & date two and putting them into a separate field - that did not work. If anyone has any ideas I would appreciate it. Thanks

Link to comment
Share on other sites

Create fields

FindDate1 = Date

FindDate2 =Date

 

Create a Field called TwoDateFind = calc= FindDate1 & "..." & FindDate2

 

Create find layout with 2 date fields

 

Script attached to find button in Data layout

 

Goto to layout [Find Date]

Enter find mode[pause]

Set field [YourDateField, TwoDateFind]

Perform Find [ ]

Go to Layout [Original]

 

In your Find Date layout

Enter text uder the 2 Fields

 

"Enter Date 1 and Date 2 in the fields above ,Then Press Enter"

 

When they press enter it re-activates the find that we put in pause in the script cool.gif

 

Also See http://www.fmfiles.com/newtips.html

look for

Last 24 Hours - This tip file will find date and time ranges for you, and it will also find all records within the last 24 hours.

 

This is a file I created and is unlocked . Inside you will find an example of the above post

Link to comment
Share on other sites

Create fields

FindDate1 = Date

FindDate2 =Date

Create a Field called TwoDateFind = calc= FindDate1 & "..." & FindDate2

Create find layout with 2 date fields

Script attached to find button in Data layout

Goto to layout [Find Date]

Enter find mode[pause]

Set field [YourDateField, TwoDateFind]

Perform Find [ ]

Go to Layout [Original]

This won't work

First, cause the calc field would never avaluate in find mode so you can't say

Set field [YourDateField, TwoDateFind], where Datefind is an calc field even if FindDate1and FindDate2 were globals (in which case you wouldn't be even able to enter any data in find mode).

The only way you could use calc in Find Mode is script step "Insert Calculated Result"

But, here comes the second point, even if you use this step whit above calculation it won't still work.

The reason why is that the result of calculation is not an valid date so you can not use it with any "Set" function on an date field.

BTW the above calc would convert FindDate1 and FindDate2 in numbers and than it would concatenate them (with "..." between them)

But neither using DateTotext before won't work.

So only way that I know is to use copy and paste.

 

Goto to layout [Find Date]

Enter find mode[pause]

Copy[FindDate1]

Paste[yourDate,select]

PaseLiteral[yourDate,"..."] //without selection

Copy[FindDate2]

Paste[yourDate]//without selection

Perform Find [ ]

Go to Layout [Original]

 

HTH

 

Dj

Link to comment
Share on other sites

DJ

Your solution worked - except I had to cut not copy - otherwise that info also remained in the find.

 

Chopper

Your solution would not work for a date range that included multiple months or different years. But it worked for single month in a one year.

 

Thanks for you help!

Karen

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

Terms of Use