9 Replies Latest reply on Feb 19, 2013 9:24 AM by willrollo

    replace field contents

      Title

      replace field contents

      Post

           I am having an issue with replacing field contents based on the data of another field in the same table. I have tried calcs, script triggers, replace field contents, Ifs, cases and other ways!

           All I want to do is alter an existing category field that has three radio check boxes with the data "Trade, Customer or employee". I have another field that is for a discount amount. This is either 0 or more than 0. If it is more than 0 I want the category field to check Trade. I haver used this as a calc on the categortuy field and as an replace contents but to no avail:

            

           If(Discount  = 0 ; Category = "Customer" ;  Category ="Trade")

           All fields are basic text fields at the moment and free to enter data in browse mode..

           I am sure it is something simple - a bit like how I feel at the moment!

        • 1. Re: replace field contents
          philmodjunk

               Try:

               If(Discount  = 0 ; "Customer" ;  "Trade")

               And be sure to specify the Category field if this is in a script or be sure that the cursor is in the category field if this is a manual replace field contents operation.

          • 2. Re: replace field contents
            JimMac

                 Radio Buttons is a OR function.  Check boxes are a AND function.  You have 3 possibilites, with a two state IF.  There is no such thing as a Radio check box.  I think this may be your problem.

                 Jim...

            • 3. Re: replace field contents
              philmodjunk

                   Note, I assumed that will meant radio buttons with my suggested solution...

              • 4. Re: replace field contents

                     Thanks Phil

                     I thought I had done that one already as it is the most obvious. It worked  - thanks

                     Thanks also, Jim, I meant radio buttons...But all solved now..

                • 5. Re: replace field contents

                       Following on from the first (solved) question, how would I go about a similar action when I have two normal fields.

                        

                       Issue I have - Source field in my table. I have imported data from an excel spreadsheet that provides a number into this source field. Ihave another excel spreadsheet that has the numbers in one column and the Source name in the next., each row being a new source record.

                       How do i get FM to alter the imported source data (number) to a source name?

                       I have tried a few things (I have imported the source excel file as a new temp table in my FM Db) but mow stumped...

                       thank you

                  • 6. Re: replace field contents
                    philmodjunk

                         You don't actually have to use replace field contents for that. YOu could set up an auto-enter calculation on the field that replaces the number with the value's labeling text if you enable auto-enter options during import. That may not be feasible but is an alternative to replace field contents.

                         Replace field contents would be setup to work exactly as in your first case, though perhaps with a case funcition instead of If so that you can work with more than two possible values.

                         Make sure the field is defined as text since you are replacing numbers with text in this operation.

                    • 7. Re: replace field contents

                           Hi Phil

                           I think I will try the autoenter options first, as I dont fancy typing in 50 or so entries for a case calc! thx

                      • 8. Re: replace field contents
                        philmodjunk

                             Maybe you don't even need that. Couldn't you just import the source name column of data into this field and not use any auto-enter setting or replace field contents operation?

                        • 9. Re: replace field contents

                               Not really - The number code that is on the customers table (imported table) is linked to the source table (imported table). It is the source table that has the names of the sources on it.

                               So at the moment a customer record will have e.g. 34 as the source field. the source table will have a record (now i have imported it into fm as a temp table) with a number 34 and a field for despcription which will have email as the data.

                               Acutally i am already half way doing an autoenter calc so it may not be too trciky 0 didnt realise I can copy/paste columns from excel into the calc in fm