0

Help me LOOP please.

if 'Column 1' = 'Static Site Data'.'Risks and Mitigation Costs per Site'.'Type Specific Risks'.'Risk List1' then 'Column 1' = 'Static Site Data'.'Risks and Mitigation Costs per Site'.'Type Specific Risks'.'Risk List1' 

else 

if 'Column 1' = 'Static Site Data'.'Risks and Mitigation Costs per Site'.'Site Specific Risks'.'Risk List1' then 'Column 1' = 'Static Site Data'.'Risks and Mitigation Costs per Site'.'Site Specific Risks'.'Risk List1' 

I want to repeat this code over and over again in a loop until its true, then print it. I want the Risk List to increase by 1 each time. So from the code its Risk List1, I want it to be Risk List2, Risk List3, and so on, everytime it is looped until it matches.

7 replies

null
    • Daniel_Berrow
    • 1 yr ago
    • Reported - view

    Can I ask why you are looping through this way to try and find something that matches? Is this a search function?

      • Vinson_Javiero
      • 1 yr ago
      • Reported - view

       Its like a search function, yes...

    • John_Halls
    • 1 yr ago
    • Reported - view

    It's a tell tail sign that when you have fields called 'Risk List1','Risk List2', 'Risk List3' that you are using fields rather than records. Once you have your database normalised (split up into tables that are joined together correctly) then this task will become much, much easier.

    Can you send over a copy of your database?

    Thanks John

      • Vinson_Javiero
      • 1 yr ago
      • Reported - view

       This Risk List 1, 2, 3 and so on are relationships between 2 tables. Lets say theres a table called "Types" containing list of types of Sites. 1 Type of Site may contain several risks.. These collection of risks are gathered in a risk list, formed in a table called the Risk List. So I made a one to many connection between the Types table and the Risk List table. 

      Lets say Type 1 has Risks 1, 2, and 9.. I connected those 2 tables by creating relationships.. connecting 1 risk to each relationship. Hence, from the Type table, its connected to Risk List1, Risk List 2, Risk List 9.

      Then Id like to make a report in another table. This table is called "Reports. I have a text fields in the reports table called Column 1, Column 2, Column 3. Column 1 has a string "1", Column 2 has a string "2", Column 3 has a string "9". If Column 1 has a string of "1", I would like to recall the details of Risk List 1., and so on.. in another formula field.

      These table are connected through relationships (mostly one to many relationships). Data model is also pretty with all the arrows.

      Im quite a newbie in coding but I know this must work.. because this must be a very simple thing to do for a relational database! Is this something you can do with a loop?

    • Fred
    • 1 yr ago
    • Reported - view
     said:
    Then Id like to make a report in another table. This table is called "Reports. I have a text fields in the reports table called Column 1, Column 2, Column 3. Column 1 has a string "1", Column 2 has a string "2", Column 3 has a string "9". If Column 1 has a string of "1", I would like to recall the details of Risk List 1., and so on.. in another formula field.

     In the table Risk List, what is the field name that you would use to search for the string "1" or "2", etc?

    I can see many back and forths asking for field name and types. To help simplify things, can you upload a sample DB?

      • Vinson_Javiero
      • 1 yr ago
      • Reported - view

      Risk Number. I'm sorry, I dont think I can share it publicly because I am protecting my company data's confidentiality. But I still hope you can help me..

      • Fred
      • 1 yr ago
      • Reported - view

      From your posts I think it will help us all if you can copy your DB and put in some nonsense data so we can see what is going on.

Content aside

  • 1 yr agoLast active
  • 7Replies
  • 74Views
  • 4 Following