Jump to content

Duplicate record with colored font


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

Recommended Posts

I can't seem to find anyone using this. I don't know if I am doing too much, as in there maybe some built in functionality I am not aware of.

I am looking to duplicate a record but make all data copied formatted with a red font. This will be a quality control tool when our customer service department copies data from a similar job.

This is what I have in my brain, sorry if it does not translate well with FMP.

function duplicateRecordInRed() {

// copy data from each field to var

set fieldCount to count(every field of current record)

set i to 0

while i < fieldCount

set var i to field i // don't know if I can instantiate vars at run time?!?!

i++

end while

create new record()

// copy var data back into new fields with red formatting

set fieldCount to count(every field of current record)

set i to 0

while i < fieldCount

set field i to var i with font color red

i++

end while

}

Does this sound like I am on the right track?

Bonus:

When this function is working I will need to create some type of functionality to revert each field to standard formatting once the data has been checked for accuracy. A small button next to each field with a script to format that field back to default formatting has been requested.

I only add this incase it seems relevant as to how the solution maybe constructed with the additional information.

Thanks a ton in advance for your time and help!

May the Lord Jesus Christ bless you unto salvation from the wrath to come, through faith in His work on the cross!

Link to comment
Share on other sites

Hi Greg,

You might try this approach ... it would be safer and less task intensive ... (attached), using conditional formatting.

When you duplicate a record, just set the IsColor flag to 1. User can uncheck it once it has been verified.

DupColored.zip

Link to comment
Share on other sites

You will need to apply conditional formatting to any layouts where it is needed since conditional formatting is layout specific. You could also attach an auto-enter (replace) calculation to each field with:

Case (

IsColor ; TextColor ( Self ; RGB ( 255 ; 0 ; 0 ) ) ;

TextColorRemove ( Self ) )

... but that would be more resource intensive. Using script would be last method I would use since it can break and you would constantly need to maintain a specific layout where the fields exist for your looping script (adding new fields). Really, does every field need to be colorized anyway? Wouldn't a simple text box in red NEW next to the record suffice? The boolean flag IsColor can display the words NEW (see Inspector > Data tab > Data formatting and at bottom, number formatted as boolean.

I highly recommend against colorizing actual text - that is what layout formatting is for. :laugh2:

Link to comment
Share on other sites

I am looking to duplicate a record but make all data copied formatted with a red font. This will be a quality control tool when our customer service department copies data from a similar job.

I am not sure what exactly you mean by that. As a general rule, data should be stored at one location only and not duplicated or copied elsewhere (other than as a template to be modified).

----

See also:

http://fmforums.com/forum/topic/78565-add-a-new-record-into-two-tables-at-once/page__view__findpost__p__367120

Link to comment
Share on other sites

I feel it is a little difficult to relay my ideas via type. The posted example is close but I am looking to do this for each field.

I am not sure how to implement what you were saying by...

Case (

IsColor ; TextColor ( Self ; RGB ( 255 ; 0 ; 0 ) ) ;

TextColorRemove ( Self ) )

I also am hoping to avoid adding a field to store a boolean next to each field as this will require two fields for every one field that exists, and some jobs may only be using half the fields as it is.

Please see the attached and see if it makes a little more sense as to what I am looking to do.

Notice one button on the top right would duplicate the record. However it currently does a regular duplication. I would like to be able to copy a record plain as that only make field that has data red when it is copied into the new record.

Next please notice the red buttons next to the fields. I have individual scripts attached to each one. Each script attached to each button would be specifically for one field to turn it back to default coloring.

Do you think your understanding what I am after?

DupColorRequest.fp7.zip

Link to comment
Share on other sites

Please see the attached and see if it makes a little more sense as to what I am looking to do.

I makes clear what you are trying to do, but not why you are trying to do it - esp. the part where you duplicate a record.

I also am hoping to avoid adding a field to store a boolean next to each field as this will require two fields for every one field that exists, and some jobs may only be using half the fields as it is.

You could save fields by having a single text field listing the fieldnames of fields that are still "suspect". Or use a repeating field for the same purpose. In any case, using text color instead of a field to store data is not a good idea, IMHO.

Link to comment
Share on other sites

So you want the User to duplicate an existing record to use as default template from which to work (that is fairly normal request) and then they must 'check off' that they verified each field as either 1) the value should remain same or 2) they have changed it?

If so, see attached. Click your Duplicate button then the first button. It uses conditional formatting on the fields for visual message. It uses a developer layout in which you place the fields you want to dynamically appear in the list. The fields are red if their name appears in this list (a data field auto-entered with field names). Button by field (using script parameter) removes the field name from the list, turning it black.

But Michael is absolutely correct ... you will have no way to verify later that it was done. I would think clicking a button should write a record of the User, maybe date, time etc if it is important. Anyway, if only a visual assistant to walk down fields, this sample may do it. I only connected the first three fields.

Changed a sentence for clarity.

I guess, since I am using a regular text field within the record itself, that data field would remain for a visual list of which fields were not yet checked. But it would not provide information about when or who did check it.

FILE REMOVED. Please see modified demo below.

Edited by LaRetta
Link to comment
Share on other sites

So you want the User to duplicate an existing record to use as default template from which to work (that is fairly normal request) and then they must 'check off' each field that 1) the value is the same or 2) they have checked it?

Yes, exactly!

Lifetime Student, I think you got it man! I am not sure what your doing yet. But it looks like it is doing what I am looking for! I am almost positive this is solved. Is there a way to mark this post as solved?

May the Lord bless you and thanks a ton!

And... can you brief me through what your doing... I don't think I am seeing all that your doing... :hmm:

Link to comment
Share on other sites

I selected all those fields you want to track, copied them, created a new Contact Management empty layout and pasted them on. I named this layout Field Tracker. You must never change the name of this layout without changing all of the calculations which will depend upon this layout because the conditional formatting will break and so will 'uncolorizing' the fields - because Field Tracker layout name is hard-coded. You could also just type your field names into a global text called gFields (when unserved). If only a few fields, this might be simpler and safer overall.

I created a regular text field in Contact Management called zzz_data with auto-enter (do not replace) calculation of:

FieldNames ( Get ( FileName ) ; "Field Tracker" ) … it could very well just auto-enter that global field directly.

Then each field on your data-entry layout has conditional formatting calculation. Your first field has:

Let ( field = "Name_First" ; not IsEmpty ( FilterValues ( Contact Management::zzzz_data ; field ) ) )

Below, specify color text red. Repeat on each field, changing the name in bold to the real field’s name. The buttons all use same script but script parameter is the field name. That’s about it. Conditional formatting turns red when the field name exists in the list and turns black again when field name is removed from the list. You don't need any of that on the layout - I just put that there so you could see it.

When I have implemented such a technique, I've had to change it later to records because management then decided they want to know who wasn't or was doing what, LOL.

As for marking posts as solved, this forum doesn't need one ... posts are always solved to complete client satisfaction. :laugh:

Oh, also keep in mind that the 'current fields on Field Tracker' are entered as data into that zzzz_data field. So if you later add a field onto that layout, it will not automatically appear in the list.

Link to comment
Share on other sites

Very cool solution! Thank you very much! I really like it.

I was going to ask you to walk through a couple of the calculations you used but I think it would serve better if I might be pointed toward some material that would discuss working with custom function and calculations. Do you know of any good tutorials that would help me become self proficient in scripting or are we talking about collage courses? I feel like the calculation look more daunting then they really are?!?!

Also I discovered a bug. I found it because I was wondering if you could click the button next to a field again to make it red again but it keeps deleting other entries in the zzzz_data field. :hmm: Any idea whats going on there?

Again thanks for a huge step in the right direction!

Link to comment
Share on other sites

I was sloppy and didn't even consider that you might want to revert the value. Anyway, I corrected and reattached the demo, naming it DupColorRequestMOD2. The only thing that changed is the script Set Field[] step.

As for training materials, start with your online FM Help, reading through the calculation examples. You are at the right place - begin reading the posts and seeing how the calculations are put together. You will begin to catch on in no time. :^)

DupColorRequestMOD2.zip

Link to comment
Share on other sites

LaRetta, Thank you for your help. I wanted to make mention that it is still acting a touch buggy. If you follow the steps you will see what it is doing. Duplicate a record, hit the button next to First name, press the same button next to first name again. The zzzz_data field stacks the "Name_First" on the same line as "Phone1" rather then putting it on a new line.

I am disclosing that bug more for people who might stubble upon this thread.

It turns out that there is a few computers that are unfortunately still running FMP 8.5.

Do you think it is possible to get the same type of functionality by copying a fields' data and pasting it into a records field with red formatting. I was thinking maybe have a script copy and format the data, rather then having the layout using conditional formatting.

Does this sound possible?

I am not looking for a hand out maybe even an idea to get me going in the right direction.

Thanks again!

Link to comment
Share on other sites

Thank you, Michael. It was feeling clunky when I created it but I just didn't have the time to get back to it and still don't. :laugh2: Sorry, Greg, sometimes we tag-team around here and sometimes Michael cleans up behind us although we try to always provide perfection, as you know, we all fall short (some more than others, LOL).

Link to comment
Share on other sites

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