1 2 Previous Next 21 Replies Latest reply on Jan 29, 2012 1:31 PM by Fagreement

    Concat string

    Fagreement

      Title

      Concat string

      Post

      simple question:

      i qm using the following statement to filter a portal in a FM layout:

      PatternCount ( GlobalFields::gField7 ; GlobalFields::gCriteria7)

      the issue is that GlobalFields::gField7 contain let's say DocumentName and I want to concat Document:: with DocumentName to have finally this:

      PatternCount ( Document::DocumentName ; GlobalFields::gCriteria7)

       

      how? cause ("Document::" & GlobalFields::gField7)  doens't work with the PatternCount formula

        • 1. Re: Concat string
          Sorbsbuster

          Does the field GlobalFields::gCriteria7 really contain the text:

          "Document::This is the name...etc" ?  That is, it has double colon ::, and NO spaces between the word 'Document' and the document's name?

          • 2. Re: Concat string
            Fagreement

            yes GlobalFields::gCriteria7 really contain the text.

            how can i do something like this

            PatternCount ( 'Document::' & GlobalFields::gField7 ;  GlobalFields::gCriteria7)

            • 3. Re: Concat string
              Sorbsbuster

              If, for example:

              GlobalFields::gField7 contained the text "My First Novel"
              and
              GlobalFields::gCriteria7 contained the text "ent::My F"

              then this function

              PatternCount ( "Document::" & GlobalFields::gField7 ;  GlobalFields::gCriteria7)

              should return a value of 1.

              But I don't really understand how you are using these parameters to filter anything if they are all global fields.  By definition all reords will have the same value, so you will either see all records or none.

              • 4. Re: Concat string
                Fagreement

                no, it doesn't work like this, i test it already.

                PatternCount ( "Document::" & GlobalFields::gField7 ;  GlobalFields::gCriteria7) return 0 while it should return 1.

                in fact if i do PatternCount ( Document::DocumentName ;  GlobalFields::gCriteria7) it works, it return 1 !

                that's turn me crazy !

                • 5. Re: Concat string
                  philmodjunk

                  If I use:

                  PatternCount ( "ABC" & "xyz" ; "cx" )

                  I get 1

                  If I use

                  PatternCount ( "ABC" & Table::Field ; "cx" )

                  where the field stores"xyz", I get 1.

                  What value do you expect "Document::" & GlobalFields::gField7 to produce?

                  If gField7 stores "xyz", that expression returns: Document::xyz

                  • 6. Re: Concat string
                    Fagreement

                    I have a table named Document where i have a field named DocumentName. In DocumentName i store the value "general"

                    I have another table named GlobalFields where i have a field named gField7 and gCriteria7. in gField7 i store the value "DocumentName", and in gCriteria7 i store "DocumentName"

                    in the portal, it is the table Document that is mapped. in that portal i want to filter records to have only Document records that satisfy DocumentName = "General"

                    but this statement return always 0: PatternCount ( "Document::" & GlobalFields::gField7 ;  GlobalFields::gCriteria7)

                    while this statement return 1: PatternCount ( Document::DocumentName ;  GlobalFields::gCriteria7)

                    • 7. Re: Concat string
                      philmodjunk

                      IF

                      gField7 stores the text: "DocumentName"

                      gCriteria7 stores the text: "DocumentName"

                      Patterncount ( "Document::" & GlobalFields::gField7 ; GlobalFields::gCriteria7 )

                      will produce the same result as:

                      PatternCount ( "Document::DocumentName" ; "DocumentName" )

                      Which will evaluate as 1 (True) for every record in your portal. It will not filter out any records.

                      Sure you don't have "general" stored in gCriteria7? Then you'd get a result of 0 (False) for all records and your portal would be empty.

                      If you entered "General" in gCriteria7, you could use this expression for your filter:

                      Patterncount ( GetField ( "Document::" & GlobalFields::gField7 ) ; GlobalFields::gCriteria7 )

                      • 8. Re: Concat string
                        Fagreement

                        sorrrrrrryy

                        "general" stored in gCriteria7

                        yesss, that's what i'm searching GetField ( "Document::" & GlobalFields::gField7 )

                        it works, thanks.

                         

                        remain the 2nd part of my question:

                        gOperator7 field may contain AND or OR (list box that the user use)

                        gField8 contain DocumentDescription

                        how can i do a complex filter si;ilar to this:

                        Patterncount ( GetField ( "Document::" & GlobalFields::gField7 ) ; GlobalFields::gCriteria7 ) gOperator7

                        Patterncount ( GetField ( "Document::" & GlobalFields::gField8 ) ; GlobalFields::gCriteria8 )

                        • 9. Re: Concat string
                          philmodjunk

                          Evaluate (

                          Patterncount ( GetField ( "Document::" & GlobalFields::gField7 ) ; GlobalFields::gCriteria7 ) & gOperator7 &

                          Patterncount ( GetField ( "Document::" & GlobalFields::gField8 ) ; GlobalFields::gCriteria8 )

                          )

                          • 10. Re: Concat string
                            Fagreement

                            Evaluate (

                            Patterncount ( GetField ( "Document::" & GlobalFields::gField7 ) ; GlobalFields::gCriteria7 )

                            ) works fine

                             

                            Evaluate (

                            Patterncount ( GetField ( "Document::" & GlobalFields::gField8 ) ; GlobalFields::gCriteria8 )

                            ) works fine

                             

                            Evaluate (

                            Patterncount ( GetField ( "Document::" & GlobalFields::gField7 ) ; GlobalFields::gCriteria7 ) & gOperator7 &

                            Patterncount ( GetField ( "Document::" & GlobalFields::gField8 ) ; GlobalFields::gCriteria8 )

                            ) doesn't work (with gOperator= OR ), it return 0

                            • 11. Re: Concat string
                              philmodjunk

                              Hmm wonder if you need a space character before and after the gOperator7 field....

                              Evaluate (

                              Patterncount ( GetField ( "Document::" & GlobalFields::gField7 ) ; GlobalFields::gCriteria7 ) &" "& GlobalFields::gOperator7 & " " &

                              Patterncount ( GetField ( "Document::" & GlobalFields::gField8 ) ; GlobalFields::gCriteria8 )

                              ) doesn't work (with gOperator= OR ), it return 0

                              • 12. Re: Concat string
                                Fagreement

                                yes! you are the best

                                thanks

                                • 13. Re: Concat string
                                  Fagreement

                                  i have a pbm if GlobalFields::gField8 or GlobalFields::gCriteria8 is not filled

                                  instead of that, how can i always use the statement that you defined:

                                  Evaluate (

                                  Patterncount ( GetField ( "Document::" & GlobalFields::gField7 ) ; GlobalFields::gCriteria7 ) &" "& GlobalFields::gOperator7 & " " &

                                  Patterncount ( GetField ( "Document::" & GlobalFields::gField8 ) ; GlobalFields::gCriteria8 )

                                  )

                                  • 14. Re: Concat string
                                    philmodjunk

                                    I don't see the problem. Doesn't

                                    Patterncount ( GetField ( "Document::" & GlobalFields::gField8 ) ; GlobalFields::gCriteria8 )

                                    return zero (False) if that's the case?

                                    That should then evaluate correctly.

                                    Hmmm, if BOTH are empty, you might get an empty string instead of 0. You might add a + 0 in that case to get:

                                    Evaluate (

                                    Patterncount ( GetField ( "Document::" & GlobalFields::gField7 ) ; GlobalFields::gCriteria7 ) & " " & GlobalFields::gOperator7 & " " &

                                    Patterncount ( GetField ( "Document::" & GlobalFields::gField8 ) ; GlobalFields::gCriteria8 ) + 0

                                    )

                                    1 2 Previous Next