5 Replies Latest reply on Oct 15, 2014 10:12 AM by philmodjunk

    find mode in loop condation

    lamp

      Title

      find mode in loop condation

      Post

      Dear All,

      Please help.

      I have two tables (Company and Query)

      I am trying to know how many Quires the Companies have made.

      The following script works only with one company. It shows the number of calls a company has made.

      Set Error Capture [On]

      Go to Layout ["Company Calls" (Company)]

      Set Variable [$ComID: Value:Company::CompanyID]

      Go to Layout ["Query" (Query)]

      Enter Find Mode[]

      Set Field [Query::fk_CompanyID; $ComID]

      Perform Find[]

      Set Field [Company::Company all Calls; Get ( FoundCount)]

      Go to Layout ["Company Calls" (Company)

      As I have 60 companies or more. How Can I get the result of all on one click ( how to put it in loop).

      Please let me know if more detail are need it.

      I appreciate your help.

      Thanks

      Lamp

        • 1. Re: find mode in loop condation
          philmodjunk

          Why use a script at all?

          Surely the Company and Query tables are linked by CompanyID?

          A List view layout based on Company can show the total related records in Query using either a calculation field that uses the count function or you can place a "count of" summary field from Query on the layou to show the same count.

          • 2. Re: find mode in loop condation
            lamp

            Dear philModJunk,

            I created a field on Company calls Count All and put the calculation

            Count (Query::fk_CompanyID)

            Created another Layout call All Calls Layout

            I put Company Name and Count All fields. But still not showing the calculation.

            It didn't worked. How does it update it automatically.

             

            Thanks

            Lamp

            • 3. Re: find mode in loop condation
              philmodjunk

              If correctly set up, it will update automatically.

              Do you have a relationship linking Company to Query by CompanyID?

              Is your new All Calls layout based on the Company table? (what is specified in "Show Records From" in "Layout Setup..."?)

              • 4. Re: find mode in loop condation
                lamp

                I dont have relationship link between two tables. The relation is from Company=Client=Query. But companyID is in Query table.

                Yes, the All Calls layout base is on the Company table. (Shoe Records From "Company")

                Thanks

                 

                • 5. Re: find mode in loop condation
                  philmodjunk

                  Are these the match fields in your relationships?

                  Company::__pkCompanyID = Client::_fkCompanyID

                  Query::_fkCompanyID = Client::_fkCompanyID

                  where the __pk field auto-enters a unique identifier and the _fk fields are simple data fields (number for serial number or text for UUID strings)?

                  For a given record in company, how many records might there be in Client linked to that company record?

                  It's possible that what you have can be made to work. It's also possible that adding a new Tutorial: What are Table Occurrences? of Queries that is directly linked by companyID to Company can allow you to show data from the new occurrence of Quries.