11 Replies Latest reply on Mar 19, 2009 9:22 AM by raybaudi

    search for specific leter

    lamp

      Title

      search for specific leter

      Post

      Dear All,

       

      Is there any way we can write a scrip to search for employee ID in a text field after it found it talke the number and return the number like "employee ID E00456" search take the number and result should be the number.

       

       I will appreciate any idea.

       

      Thanks 

      Lamp

        • 1. Re: search for specific leter
          raybaudi
            

          Hi lamp

           

          I didn't really understand your question...

           

          The final result must be: 00456 or 456 ?

          • 2. Re: search for specific leter
            lamp
              

            Thanks for repl.

             

            I want the result should be E00456. The reason I do that, I will use the ID to create a record in the second table for that emoloyee.

             

            Thanks

            Lamp

            • 3. Re: search for specific leter
              raybaudi
                

              E00456 isn't a number.

               

              BTW: try this calculation:

               

              RightWords ( yourTextField ; 1 )

               

              This will work if yourTextField contains data exactly like what you said.

              If not, give me more dettails.

              • 4. Re: search for specific leter
                lamp
                  

                The code you mentioned above is working thanks but it is not what I want.

                my requirement is as follow;

                I have tables (employee, queries, messages, receiveMessages)

                first I send an email to a client that email will be registered as a query in Queries table. That message will contain employeeID when client send reply I receive the reply in receiveMessage table. The employeeID is still in the header.

                 

                I want to  add a button next to the received email by clicking the button it find the employeeID and create a new queries and fill emplyeeID.

                my code is as follow

                 

                Go to Related Record [ from table: "receiveMessage"; Using layout: " receiveMessage(receiveMessage)][Show only related records]

                Set Field [ receiveMessage::gBody; receiveMessage::Body]

                Enter Find Mode []

                Set Variable [$EmplID; Value:'']

                Set Field [receiveMessage::Header; rightWords ("EmployeeID"; 1)]

                Set Variable [ $EmplID; Value:receiveMessage::Header]

                Perform Find[]

                Go to Layout [" queries" (queries)]

                New Record/Request

                Set Field [ queries::EmployeeID; $EmplID]

                Set Field [  queries::QueriesNote; receiveMessage::gBody]

                 

                 

                 

                 

                 

                 

                 

                 

                • 5. Re: search for specific leter
                  raybaudi
                    

                  > after it found it talke the number and return the number like employee ID E00456 search take the number and result should be the number.

                   

                  If I understand correctly you want to search into a generic text ( like the one above ) for the employee ID.

                   

                  If so, you can try this calculation:

                   

                  Let ([
                  adj  = Substitute ( ¶ & GenericText & ¶ ; " " ; ¶ ) ;
                  pos = Position ( adj ; "¶ID¶" ; 1 ; 1 ) ;
                  adj = Replace ( adj ; 1 ; pos + 3 ; "" )
                  ];
                  If ( pos ; GetValue ( adj ; 1 ) )
                  )

                   

                  This returns the first word after the word ID into a generic text.



                  • 6. Re: search for specific leter
                    lamp
                      

                    I used  the above code like that 

                     

                     

                    Go to Related Record [ from table: "receiveMessage"; Using layout: " receiveMessage(receiveMessage)][Show only related records]

                    Set Field [ receiveMessage::gBody; receiveMessage::Body]

                    Enter Find Mode []

                    Set Variable [$EmplID; Value:'']

                    Set Field [receiveMessage::Header; Let ([adj  = Substitute ( ¶ & GenericText & ¶ ; " " ; ¶ ) ; pos = Position ( adj ; "¶ID¶" ; 1 ; 1 ) ; adj = Replace ( adj ; 1 ; pos + 3 ; "" ) ]; If ( pos ; GetValue ( adj ; 1 ) ) )]

                    Set Variable [ $EmplID; Value:receiveMessage::Header]

                    Perform Find[]

                    Go to Layout [" queries" (queries)]

                    New Record/Request

                    Set Field [ queries::EmployeeID; $EmplID]

                    Set Field [  queries::QueriesNote; receiveMessage::gBody]

                     

                    But any time i run the script I don't get any value it reurns blank.

                     

                     

                    • 7. Re: search for specific leter
                      raybaudi
                        

                      Try this one:

                       

                      Go to Related Record [ from table: "receiveMessage"; Using layout: " receiveMessage(receiveMessage)]
                      Set Variable [ $Body; receiveMessage::Body]
                      Set Variable [ $EmplID; Value: Let ([adj  = Substitute ( ¶ & receiveMessage::Header & ¶ ; " " ; ¶ ) ; pos = Position ( adj ; "¶ID¶" ; 1 ; 1 ) ; adj = Replace ( adj ; 1 ; pos + 3 ; "" ) ]; If ( pos ; GetValue ( adj ; 1 ) ) )]
                      Go to Layout [" queries" (queries)]
                      New Record/Request
                      Set Field [ queries::EmployeeID; $EmplID]
                      Set Field [ queries::QueriesNote; $Body]


                      • 8. Re: search for specific leter
                        lamp
                          

                        Dear Daniele,

                         

                        Thanks for all your support. 

                         

                        This time It returns "receiveMessage::Header" value. what ever is in the header it brings it

                         

                         

                         

                         

                         

                        • 9. Re: search for specific leter
                          raybaudi
                            

                          Double check that , in the calc:

                           

                          Let ([adj  = Substitute ( ¶ & receiveMessage::Header & ¶ ; " " ; ¶ ) ; etc........

                           

                          you haven't put the receiveMessage::Header into quotes.

                           

                          BTW: If you want you can send me a copy of your file; write me a PM.

                          • 10. Re: search for specific leter
                            lamp
                              

                            No (receiveMessage::Header) is not into quotes.

                             

                            how can i send you a PM? I couldn't find you emeil

                             

                             

                             

                            • 11. Re: search for specific leter
                              raybaudi
                                 Look at Top Right... there is a PM for you.