How to create a lookup on a multi-field primary key?

I have a table with people of different companies. The primary key of the person table is: compId and personId. I have an organisation chart where I want to create a lookup of the head of the department. the primary key of organisation table is compId and orgId. In the organisation table I have a field chief_personId. Now I need a lookup on this chief field. I need a lookup fromthe table person where compId=’{compid}’ and personId={chief_personid}

My problem is that I cannot use select as it does not allow me to add a where clause. I cannot use a text autocomplete because if I create a link I can only apply for one key (person_id).

Albert Hello, my name is Leandro and I’m with the same problem as you.
I am using a GRID and I have to show 2 parameters from a table, I had thought the first parameter stored in a variable and then pass it to the Lookup, not tried it yet, but I did not find another solution. If you solved it in another way, I ask if you can spend the data.
Greetings.

Hi Leandro,
I solved the issue by creating a caption link. You create a grid application on the table you need the lookup from. You can set additional filters because this sql can be modified. If you need more than one field from a select then you have to apply a trick. You select the keyfield from the lookup. Then if you enter field 2 you can trigger an ajax event. In this event you can put a manual select on your table and fill all the fields. If you have only one extra field you can concider using a standard lookup.

Thanks Albert for your prompt response, I’m new to ScriptCase, Now I’m taking the first steps, I will try this mention, but first, I have to learn to handle this ajax events, greetings …

Albert I could not do it, you through an example to see if you can guide me a bit
*
The issue is as follows:
We have 3 tables with the following fields:

Table1
IdTabla1, varchar and primary key
Detail, varchar
*

Table2
IdTabla1, varchar and primary key (refer to Table 1)
IdTabla2, varchar and primary key
Detail, varchar

Table3
IdTabla1, varchar and primary key (refer to Table 1)
IdTabla2, varchar and primary key (refer to Table 2)
IdTabla3, varchar and primary key
Detail, varchar

When we create a grid for table 3, we IdTabla1 field lookup in Table 1, now when we need to lookup in table2, I need to pass 2 parameters to the SQL query, the IdTabla1 and IdTabla2 to show me the detail field Table2 , ie a filter fields are IdTabla1 and IdTabla2 of Table2.

I send a greeting.

When you select the record on table 1 you need to store the key in a global variable. This global variable can be used as a parameter for the sql query. From t2->t3 is straight forward, except that the lookup is altered with a where for key 1