Jump to content

Script to reset all fields


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

Recommended Posts

Hi guys, I searched a lot but coudn't find anything that could help me.

I'm using filemaker pro 14 and i'm trying to make a script that can reset all the fields in a popout button. I'm thinking of something like

Go to field (first field)

loop

set field ("") // or maybe clear (select), not sure

go to next field

exit loop if ( current field name = "first field name"

thanks for your help!

because setting the value to " " for each one isn't the best solution, thanks for your help!

Link to comment
Share on other sites

1 hour ago, Lee Smith said:

I’m not sure I’m understanding your question.

Are you clearing the field or replacing the data in the field?

http://www.filemaker.com/help/12/fmp/html/scripts_ref1.36.10.html

HTH

Lee

Hi Lee, when I want to insert a new record by the popup button I can see the data from the previous inserted record.

So I would like to reset the fields when ever the poput button is clicked, I guess it's clear the field because I woudn't want to see anything on there

Link to comment
Share on other sites

Hi Muskee,

BTW, it isn’t necessary to capture the post of others if you are not making inline comments.

I’m still not sure of your question.

Will these be new records, or are you modifying the existing records?

IIUC, It sounds like you are creating new records. If so have you tried using Table View?

If they are related records are you allowing for creation of new related records in your Relationship?

Lee

Link to comment
Share on other sites

I have a popup button with the only purpose of inserting new clients in the database, when I click on it, it opens the information of the previous inserted client. So if I want to insert a new client I must manually delete the data that is showing up and add the new information of the new client. Get it?
So how to make the script that every time I click the button every field gets enabled to insert a new client?

Link to comment
Share on other sites

Post a copy of your file, you have an error in your script I believe.

BYW, are the “Previous Clients Records” still intact?

One other thing, are sure you are not entering the new client in a Find View?

Link to comment
Share on other sites

I haven't made a script yet, that's the reason I posted because I'm not sure how to do it >_<

Look at my layout:
FTBjqcB.png

I'm entering the clients in the List View option, So when you hit the add client button it brings you the data from the previous client,

How to make the script so that every time you push the button no previous data shows and allows you to insert a new client?

The proyect is big and has user accounts, but with the screenshot I think you can understand better the situation

Link to comment
Share on other sites

Maybe @muskee is saying that the fields on the popover are globals? So, you click the popover, fill out the fields, then click "New" or "Submit" or something? If so, that's when I think you should clear them out. And if so, yes you could do it using Set Field and a Loop as you described. What is the issue you're having with that?

Link to comment
Share on other sites

22 hours ago, muskee said:

setting the value to " " for each one isn't the best solution

If you want to loop over the fields in a popover (as opposed to all fields in the layout's tab order), then you first need to construct a list of such fields. And a series of Set Field[] steps could just as well be it.

However, I believe your real problem lies elsewhere:

17 hours ago, muskee said:

I'm entering the clients in the List View option, So when you hit the add client button it brings you the data from the previous client,

That should not be happening. To add a new client, you should start by creating a new record. Then all the fields will be empty (unless they are set to auto-enter data). You most certainly do not want to clear existing client's data in order to "make room" for a new one. That wouldn't work anyway.

 

17 hours ago, Fitch said:

Maybe @muskee is saying that the fields on the popover are globals?

Possibly - but then I would recommend they switch to using the regular fields.

 

Edited by comment
Link to comment
Share on other sites

16 minutes ago, comment said:

That should not be happening. To add a new client, you should start by creating a new record. Then all the fields will be empty (unless they are set to auto-enter data). You most certainly do not want to clear existing client's data in order to "make room" for a new one. That wouldn't work anyway.

I'm not using the Add new record button that is incorporated in the filemaker platform, I tried to make my own but idk how to make the script for it to work as a add new record button, the button does add new clients but sometimes shows the data of the previous client.

Link to comment
Share on other sites

12 hours ago, comment said:

I have a problem >_<

I have enabled the relationship option to "allow creation of records in this table via this relationship".

I have 2 tables, table of clients and table of assets. A client has many assets, and one asset is only assigned to one client.
Layout A shows the assets information and the client that owns that asset.  Layout A is linked with the Assets table.

So when I'm on Layout A and want to add a new client from the popup button I made with  the "New Record/Request" command, I end up adding a new client but at the same time a new asset. I wish to only add a client from this button I made, would that be possible? I put the script to trigger on object enter

 

Link to comment
Share on other sites

A relationship allowed to create records will always create a related record. Using the existing relationship, you can create a new record in Clients only if the current asset does not already have a related client record. Otherwise you would be merely changing the existing client's data.

To create a new, unrelated, client, from a layout of Assets, you would have to define another relationship and make sure to unlink the newly created record immediately after committing it - so that the related fields are empty for the next client you would want to create.  IMHO, it would be preferable to simply go to a layout of Clients and create a new record there.

  • Like 1
Link to comment
Share on other sites

15 hours ago, comment said:

A relationship allowed to create records will always create a related record. Using the existing relationship, you can create a new record in Clients only if the current asset does not already have a related client record. Otherwise you would be merely changing the existing client's data.

To create a new, unrelated, client, from a layout of Assets, you would have to define another relationship and make sure to unlink the newly created record immediately after committing it - so that the related fields are empty for the next client you would want to create.  IMHO, it would be preferable to simply go to a layout of Clients and create a new record there.

Alright, thanks for your suggestions, I'll do as told!

Link to comment
Share on other sites

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