0

Assigning value from one or another table

Hello Everyone

It's quite complicated question, but I will try to explained it.

Let say I have 3 Tables - 1, 2 and 3.

In table one I have a field, where the value has to be dependent from that, from what other table (2 or 3) this record was generated.

With other words - If i create a record in table 1 from table 2 - the field has to have a value A.

If I create the record in table 1 from table 3 - the field has to have a value B.

The A and B are existing values in tables 2 and 3.

3 replies

null
    • Fred
    • 5 days ago
    • Reported - view

    Are these tables linked with a reference field? That will make things easier.

    If they are linked with reference fields then you do something like:

    if table2 then "A"
    else
        if table3 then "B"
    end
    
    

    I've attached a sample DB. If you create a record from Table2 or Table3 to Table1 then the formula field will fill in accordingly.

    The logic reads, if the field table2 has value then put the letter A, and if table2 has no value then check table3 if that has a value then show the letter B and if that doesn't have a value then show nothing.

      • george_tanev.1
      • yesterday
      • Reported - view

       Thank you, but it's a little bit more complicated.

      Unfortunately all the tables are on Cyrilic language and I can't make some pictures, because they will not help too much. But...

      Let say in Table Client I have information for the client.

      From thete I have the possibility to create a new record in another table - Work.

      At the same time I have also a possibility from Client to create a new record in another table - Protocol.

      And from the Protocol I can create a new recort in the Work as well.

      I am trying to make it like that - no matter from where the record is created in Work table, I have to have the same customer name - to be able to see the results in the Relashionship table in Customer table/Work.
      I hope I was able to explain it.
      Theorethically one field in Work table - the name of the customer - has to be the same - no matter from where the record is created.

      • Fred
      • yesterday
      • Reported - view

       Let me see if I get the relationships. The Client table has a 1:M relationship to Work and Protocol (1 client record is related to many Work and Protocol records). Protocol in addition has a 1:M to Work. If that is true then in Work you can create a formula field that says:

      if Client then
          Client.Name
      else
          if Protocol then Protocol.Client.Name end
      end
      

      So it says to to check the Client field and if it has data then show me the data from the Name field. If it is empty then check if the Protocol field has data and if it does then show me the data from the Name field from the Client field.

Content aside

  • yesterdayLast active
  • 3Replies
  • 23Views
  • 2 Following