CKonash

Trigger one File to create a new record in another file.

8 posts in this topic

Hi, 

I have searched everywhere and could not find something I could apply to do what I am looking for. 

I have a Fire Dept database that I manage, they have a table of "Event Reports" for each call.  Within our Fire Departments we have 14 towns that are part of a Mutual Aid Group which has a radio desk that manages large, multi resource incidents.  I would like to develop a database to help them manage the resources at the incidents since a handful of departments are already using the database solution I host for them on a server.  

I would like to create a script that copies the values in about 6 fields on an Event Report from a townships database and have a new record created in the Mutual Aid database and have those 6 values set into their respective fields?  

I understand the set variable and set field steps but spanning those from one file to another is not something I have done before.  

Any help would be really appreciated.   

Town Database the data is coming from.  

Event Report:Time

Event Report:Type of Event

Event Report:Full Address

Event Report:Township

Evnet Report:I.C.S. Officer

 

Mutual Aid Database the data is going to. 

Incidents:Township

Incidents:Address

Incidents:TimeStart

Incidents:EventType

Incidents:CommandOfficer

Edited by CKonash

Share this post


Link to post
Share on other sites

Hi there

If I were doing this, I would Perform a Script that exists in the Mutual Aid database, from the Townships database, and pass the information as a Script parameter, separated by carriage returns.

So in the Townships database you do something like :-

Perform Script (External Database: Mutual Aid DB ; Add Record Script ; ScriptParameter "Time¶Type Of Event¶Full Address¶Township¶ICS Officer ")

and then in the Mutual Aid DB, you would have a script like this :-

Add Record Script

Go To Layout (Data Entry)

New Record/Request

Set Field ( Township ; GetValue ( Get ( ScriptParameter ) ; 4 ) )

Set Field ( Address ; GetValue ( Get ( ScriptParameter ) ; 3 ) )

Set Field ( Time Start ; GetValue ( Get ( ScriptParameter ) ; 1 ) )

etc

This should give you a new record with all the data copied across.

Does that help?

Edited by rwoods

Share this post


Link to post
Share on other sites

Thank you very much.  I'm going to try that now.   

One thing I forgot, and was hoping I would have the ability to pass a pdf in a container field in the Township DB into a container field in the Mutual Aid DB.  Can I do that via a scrip parameter?

Thanks,

Chris

Share this post


Link to post
Share on other sites

Hi,  I tried a few things and I almost got it working, minus the container thing.  

The township script is triggering the new record script in the Mutual Aid database. :) 

The Mutual Aid Database is seeing the scrip parameter that I set but it isn't setting the fields with the values from the Township Database, it is setting the filed with what is actually typed in the scrip parameter calculation.  

How do I get the value in the fields to become the values in the scrip parameter?  

 

Thank You!. 

Chris

Screen Shot 2017-02-27 at 12.30.30 PM.png

Screen Shot 2017-02-27 at 12.28.50 PM.png

Share this post


Link to post
Share on other sites

Cancel That.   I had a dumb moment and forgot the ( & ) symbols in the calculation for the script parameter. 

Thank you. 

Chris

 

Share this post


Link to post
Share on other sites
On 2/27/2017 at 11:19 AM, rwoods said:

Add Record Script

This should give you a new record with all the data copied across.

Does that help?

Hello, 

I have been successful in getting the script to open the other file and create a record.  What I didn't think of is is it possible to specify an account username and password for it to login to the other file under?  It was working great for me because I have the same user account and password for both the databases I was working with.  I would prefer not to Login as a Guest since that would kill my security privileges I believe.  Anyone know if it is possible to specify a user account and password when using an open file script step?

Thanks very much!. 

Chris

 

Share this post


Link to post
Share on other sites
8 hours ago, CKonash said:

Hello, 

 Anyone know if it is possible to specify a user account and password when using an open file script step?

Not in a secure way because it means hard-coding the credentials somewhere.  The whole idea is that if a user needs access to a file, he needs credentials in it.  If you don't care about security that much you can use the APIs to open a file (fmp url, ActiveX, AppleEvents) and hard-code the password.

If you don't want to maintain individual accounts in a file, look at using External Authentication to use groups, which is infinitely more secure.

 

Share this post


Link to post
Share on other sites
1 hour ago, Wim Decorte said:

Not in a secure way because it means hard-coding the credentials somewhere.  

 

Thank you very much.  This would be a handoff of information between a police server and a fire server which happen to be separate.  The user account for the handoff would only be able to access the given fields and nothing else so I guess it's ok to hard-code the credentials.  I'll research how to open a fmp file using the url script step and put the credentials in the url and see how that works.  If I get into trouble I'll maybe reach out to see what I am doing wrong. 

 

Thanks,

Chris

 

Share this post


Link to post
Share on other sites

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