6 Replies Latest reply on Jun 19, 2013 4:55 AM by hrcap

    Get(activefieldname)

    hrcap

      Title

      Get(activefieldname)

      Post

           Morning Guys

            

           I am trying to make one of my scripts more generic but i cannot figure out how to get the get(activetablename) and Get(activefieldname) to work.

           Here is what i have so far:

            

           @Numbers = TextFormatRemove (Filter (Get ( ActiveFieldTableName )Get ( ActiveFieldName )); "0123456789"); 

            

            

           Any input would be appreciated

            

           Cheers

            

           Hadleigh

        • 1. Re: Get(activefieldname)
          symbister

               hmmm what exactly are you trying to do? (using the character @ in a field name is fraught with danger - don't)

          • 2. Re: Get(activefieldname)
            IT_User

                 Yes, what exactly are you trying to achieve?  The end result of getting the table and field name.

                 This might help you, though: GetFieldName Function

            • 3. Re: Get(activefieldname)
              philmodjunk

                   Just a guess here:

                   TextFormatRemove (Filter (GetField ( Get ( ActiveFieldTableName ) & "::" & Get ( ActiveFieldName ) ) ); "0123456789")

              • 4. Re: Get(activefieldname)
                hrcap

                     Hi guys, thanks for the replies,

                      

                     Phil i havent been in the office today so havent had a chance to try your suggestion.

                      

                     The script is to validate a phone number, and the script step that i am stuck on is the first if statement. The whole of the first if statement is:

                      

                      

                     Let(
                      
                     @Numbers = TextFormatRemove (Filter(Get ( ActiveFieldName ); "0123456789")); 
                      
                      
                     Length(@Numbers)  ≠  11
                      
                      
                     )
                      
                      
                     Basically instead of having to adapt the script everytime i use it for a different phone number field i want it to be generic, i.e.
                      
                     instead of specifying Employees::work_phone within the script i want to use the get(active table name) and the get (active field name) to calculate the field name and come out with the result of Employees::work_phone.
                      
                     Hope this makes sense frown
                • 5. Re: Get(activefieldname)
                  philmodjunk

                       Personally, in most cases, I wouldn't have more than one phone number field that I'd place in a  related table of phone numbers, but what I suggested earlier should work for what you want to do here.

                  • 6. Re: Get(activefieldname)
                    hrcap

                         Hi Phil

                          

                         I just tried out your solution and it works perfectly, thank you very much.

                          

                         The reason i wanted a 'generic' phone number validation script is because i will have two tables, one to log employee details and one to log company details. The solution will then be issued to my clients and should i need to make a change to the script in the future i wanted to ensure that i then didnt have to make changes hundreds of field references.

                          

                         Cheers