Jump to content

Script to replace a selected Radio Button


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

Recommended Posts

I have a series of records that at the start of each session I need the radio buttons to be ideally blank so I start with a clear slate. But from what I understand this cannot be done so I have decided to go with the option choice of including a CLEAR option in my radio button options. The options would now read as follows: 1 2 3 4 5 6 CLEAR

 

I created a script

Go to Field [ lineitem::selected]

Replace Field Contents [lineitem::selected [lineitem::selected="CLEAR"]]

 

First everytime I try and run the script my calculation of lineitem::selected="CLEAR" has to be re-entered.

Second I get the following message:

records could not be modified because they were in use by others or your privilages do not allow you to change them.

 

Help.

Thanks in advance.

Link to comment
Share on other sites

Using a phrase like 'lineitem selected' suggests that you are 'marking' records.  This is not a good idea because it will break in multi-user situations if two Users run the script or if one user is modifying the record when the script runs.

 

As Bruce mentions, it is best to avoid Clear because the field must be on the layout for it to work whereas Set Field[] has no such limitation.  Some time in the future, you may forget and remove the field and your script will break.

 

Also, using Replace Field Contents[] can be a problem because, although you can trap for record locking, you will not know which record failed because of that record lock.

 

It would really help us to understand the purpose behind this script and to see the script itself.  I suspect that you should be using a different technique to achieve whatever results you require.  Clearing fields from a set of records before beginning is not standard practice.  :-)


Also, why are you looping if you are using Replace Field Contents[] which automatically runs through all records in the found set?  Truly, we need a bit more information to help you in the best way. 


And are you still on version 10?  If not, please update your profile.  Thank you!

Link to comment
Share on other sites

OK, I will do my best to explain.

First I am working in the latest Filemaker Advance 13 (I updated my profile)

 

Background Info:

I want to create vendor estimates that I can review from in order to create a quote on a project.

• Three to Six vendor estimates may be needed to be linked to a quote.

• Sometimes a project might have two or three quotes before one gets approved, due to spec changes.

• To save time that same quote might be used for a different project since the requirements are the same.

 

MY SOLUTION
My estimates are made up of 3 tables: Vendors, VenProd_lineitems, Products

My quotes are made up of 3 tables: Projects, ProjQuo_lineitems, Quote

 

In the VenProd_lineitems table I have a field called "selected" it consists of a radio button that I select 1,2,3,4,5,6, or CLEAR

In a portal I see all products and my goal is to select the relevant product estimates for my quote by choosing from 1,2,3,4,5, or 6 for the records I desire.

Then in a quote I would copy these choices over into simular fields found on my quote so I can reference them only to that quote and reuse the existing estimate for other quotes.

I then clear the radio buttons so I can make my selections all over again for the next quote.

Clear was the only thing that I could get to work for my needs and I looped it so it would go through all records.

I tried "" to replace my "selected" choice with a blank (didn't work) , I then tried "CLEAR" so the number choices would be erased by the selection of the CLEAR choice, but it never worked either.

 

Right now my challenge is figuring out how to clear my radio button selections made so I am always using a clear slate.

I am only looping, as I thought it to be the best way. It was working with clear and I tried everything else with and without looping to no success.

 

Script for Set Field

Show All Records

Set Field [VenProd_lineitems::selected[""]]

 

 

Script for Replace Field Contents

Show All Records

Go to Layout["Listing_EstimateItems" (VenProd_lineitems)]

Replace Field Contents [VenProd_lineitems::selected[""]]

Commit Records/Requests[]

 

 

I hope this better explains things.

Any input appreciated as I am not hung up on my solution being the best way to get my desired results.

Thanks in advance.

Link to comment
Share on other sites

I don't understand your (extended) explanation, esp. this part:

 

In the VenProd_lineitems table I have a field called "selected" it consists of a radio button that I select 1,2,3,4,5,6, or CLEAR

In a portal I see all products and my goal is to select the relevant product estimates for my quote by choosing from 1,2,3,4,5, or 6 for the records I desire.

Then in a quote I would copy these choices over into simular fields found on my quote so I can reference them only to that quote and reuse the existing estimate for other quotes.

 

I am guessing that this radio button field is used only to narrow down the choices (of products? estimates?). If so, this field should very likely be a global field, and no permanent record of the selection (in the radio button field) should be kept anywhere - and certainly not copied to other records.

Link to comment
Share on other sites

Yes the radio button field is used to narrow down the estimates. So by making this a global field I can make my selection as to which estimates I want and then I copy them to my quote for reference?

Is this what your suggesting?

 

No, I am not suggesting you copy anything.  I don't see why copying is required - though I may be missing a thing or two in your description. It seems to me you should make your selection directly where it's needed. Once the selection is done, the global becomes irrelevant and can be cleared for making another selection, if required.

Link to comment
Share on other sites

  • 2 weeks later...

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