11 Replies Latest reply on Jun 16, 2009 4:52 AM by comment_1

    Text field value within another text field?

    cpcnw

      Title

      Text field value within another text field?

      Post

      Hi,

       

      Is there any way to include text from another field within a text field ?

       

      I am guessing there is probably some kind of syntax required

       

      Field Content {Box::Item} or something like that?

       

      Thanks!

        • 1. Re: Text field value within another text field?
          LaRetta_1
            

          There are a few ways but the easiest would be create a new concatenated calculation (result is text) with:

           

           Field Contents & ". " & Box::Item

           

          You might first consider merge fields which would be something like:

           

          <<Main Table::Field Content >>  <<Box::Item>> ... and you can even include static text between. 

           

          But if you want to insert text actually 'in the middle' of another text field instead of grouping them together then you can do that also with another calculation or by script but it would help to know how you are using this information.  Can you explain a bit more of what you need?

          • 2. Re: Text field value within another text field?
            comment_1
              

            If I understand your question correctly:

             

            There is no  "Field Content" function - you just enter the field's name into the formula box, e.g.:

             

            "A " & Box::Item & " is in this box."

             

            will return:

             

            A jewel is in this box.

             

            when the field Box::Item contains the text "jewel".

            • 3. Re: Text field value within another text field?
              cpcnw
                

              Most helpeful - the next logical question ....

               

              Is there a way to include a number field within the content of another number field?

               

              Thanks!

              • 4. Re: Text field value within another text field?
                comment_1
                   Yes or no - depends on what you mean. A number field contains a number (usually - Filemaker is not very strict about that). To combine fields, you need to perform a calculation. This could be done in a calculation field whose result type is Number, or in a Number field with auto-entered calculated value. The calculation formula can refer to any type of field, and the final result will depend on the formula and on the type specified for the result.
                • 5. Re: Text field value within another text field?
                  cpcnw
                    

                  OK, I asked a question a while ago and I couldnt seem to get the answer to work for me so I thought I would approach it differently.

                   

                  Say I have the following fields

                   

                  CustNum [auto serial]

                  TxNum [auto serial]

                   

                  and I want ;

                   

                  TxID to look like this ;

                   

                  CustNum-TxNum (eg 001-023) that is each customer might generate several transactions ;

                   

                  Should TxID be a text field or a number field - either way how to get hyphen in place?

                   

                   

                   

                  • 6. Re: Text field value within another text field?
                    comment_1
                      

                    I am assuming both fields exist in the same table (Transactions) - although making the CustNum field auto-enter a serial there makes no sense.

                     

                     

                    You could define a calculation field (result is Text) in the same table =

                     

                    CustNum & "-" & TxNum

                     

                    or you could just type this on a layout of Transactions:

                     

                    <<CustNum>>-<<TxNum>>

                     

                     

                    Before you ask, banish the thought of keeping separate numbering series for each customer's transactions.

                    Note also that "001" is text, not a number.

                    • 7. Re: Text field value within another text field?
                      cpcnw
                        

                      Thanks SuperC - appreciate the help :)

                       

                      CustNum is in one table, TxNum in another. Could you clarify this part :-

                       

                      "or you could just type this on a layout of Transactions:

                       

                      <<CustNum>>-<<TxNum>>"

                       

                      How would this be entered?

                       

                      Also, I was actually going to ask about the leading zeros, guess you are saying thats going to have to be

                      a text field?

                      • 8. Re: Text field value within another text field?
                        cpcnw
                          

                        CustNum & "-" & TxNum <- This worked fine thanks in calc field with text o/p

                         

                        > Before you ask, banish the thought of keeping separate numbering series for each customer's transactions.

                         

                        Was wondering why you said this? Is it going to get overly complicated judging by my lack of skill in FMP?

                         

                        I was thinking of something like ;

                         

                        TxCalc = Count every record matching CustNum then add 1 - this becomes 2nd part of TxID ?

                         

                        Not sure if thats possible nor makes sense - need more coffee !!!

                        • 9. Re: Text field value within another text field?
                          comment_1
                            

                           


                          cpcnw wrote:
                          CustNum is in one table, TxNum in another.
                          And how are these tables related?

                           

                           



                          cpcnw wrote:
                          How would this be entered?
                          By selecting the Text tool and typing. See the help on "Placing merge fields on a layout" for a full explanation.



                          cpcnw wrote:
                          about the leading zeros, guess you are saying thats going to have to be a text field?

                          It could be a Text field, or you could add the leading zeros by calculation where required.

                           

                           


                          cpcnw wrote:
                          Count every record matching CustNum then add 1

                          And what if a record is deleted? Or reassigned to another customer? Or when two users create a new record at the same time?

                           

                          This is not an issue of your skills, but of database theory. Records should not depend on other records, certainly not for their ID. It's very easy to produce such numbering on-the-fly - but then it won't be permanent. It will change according to the current found set, and the current sort order. Or, you can make it permanent - but then it won't respond to events happening outside of the record.






                          • 10. Re: Text field value within another text field?
                            cpcnw
                              

                            > And how are these tables related?

                             

                            I have two tables ; 1: Customers 2: Transactions - the common filed in the relationship graph is CustNum

                             

                            > By selecting the Text tool and typing.
                            > See the help on "Placing merge fields on a layout" for a full explanation.

                            Ah, OK thanks!

                             

                            > And what if a record is deleted?

                            > Or reassigned to another customer?

                            > Or when two users create a new record at the same time?

                             

                            I see your point. Hadnt really thought this through had I?

                             

                            > Records should not depend on other records, certainly not for their ID.

                             

                            Ok will bear that in mind.

                             

                            > It's very easy to produce such numbering on-the-fly - but then it won't be permanent.

                            > It will change according to the current found set, and the current sort order.

                            > Or, you can make it permanent - but then it won't respond to events happening outside of the record.

                             

                            Based on the fields CustNum and TxNum, do you think that auto serial is probably as sensible

                            choice and I should leave it at that?

                             

                            TIA :)

                             

                             

                             

                             

                             

                             

                             

                             


                            • 11. Re: Text field value within another text field?
                              comment_1
                                

                              cpcnw wrote:

                              > And how are these tables related?

                               

                              I have two tables ; 1: Customers 2: Transactions - the common filed in the relationship graph is CustNum


                              Well, then you DO have a CustNum field in the Transactions table - no need to go outside.

                               

                               


                              cpcnw wrote:
                              Based on the fields CustNum and TxNum, do you think that auto serial is probably as sensible choice and I should leave it at that?

                              I doubt anyone really cares if a customer's transactions are consecutively numbered or not.