[SOLVED] [GRID] SC_link doesn't work

I have a grid and insert a link in each row

[v_Akt_ID] = {Akt_ID};
[vAID] = 'Akt öffen ’ .{Akt_ID};

if ($v_FB_found == ‘FF’){
sc_link(Akt_ID, form_FF_Aktivitaeten_KL, Akt_ID=[v_Akt_ID], [vAID], “iframeR”);
}
if ($v_FB_found == ‘ASS’){
sc_link(Akt_ID, form_ASS_Aktivitaeten_KL, v_Akt_ID=[v_Akt_ID], [vAID], “iframeR”);
}

the link is working fine regarding the call of the different form but it is using every time only the Akt_ID from the first row of the grid view

Too bad, i am probably the only one with this problem.
Maybe it is also because of me.
But the link hint

[vAID] = 'Akt öffen ’ .{Akt_ID};

works correctly.

Do I have to consider anything when passing variables to the form?

Hi, try to use local variables, do not use global variables if it’s not necessary, so:

$param_ID = {Akt_ID};
$hint = 'Text ". {Akt_ID};

sc_link( Akt_ID, form_that_I_like, v_Akt_ID=$param_ID, $hint, “iframeR” );

with SC macro, you don’t know what is just copied and what is evaluated, maybe variables are kept as they are.

Verify the sc_redir syntax :slight_smile:sc_redir (Application, Parameter01; Parameter02; Target, Error, height_modal, width_modal)

1: the separater beetween args is the ;
2: you need to name the second arg

The syntax : v_Akt_ID=[v_Akt_ID], [vAID] in incorrect it should be somethin like this
v_Akt_ID=[v_Akt_ID];second_arg= [vAID]
Note that in the destination app, v_Akt_ID and second_arg will be seen as global vars.

Here is a sample of one of my apps with a mix of php var, global var and field var coming from a grid in order to go to a form :

$stock_out=[STOCK_ACTUEL];
$string_link = sc_make_link(form_mvt_stock_carte, stock_in=2;stock_out=$stock_out;carte_mouvemente=[IDCARTE_AVOIR];usager_mouvement={us.idusager});
{stock_icon} = ‘’.‘Affecter’;

Hi Vincenzo,
thanks for your help.
I changed the code but it has no impact. The form will allways open with the ID from the first record of the grid.
Also in the SQL statement of the form, I can’t see a WHERE parameter.

mmmm so first check if the link in the grid is correct, if the links are correct in the grid, then let’s check the form, if you want edit a specific record, you have two ways (for what I know), add a WHERE clause with ID = [param_id], where ID is the primary key field, otherwise, remove from toolbars all the items for navigations, with no navigation items, the form will ask for an ID, so you can add in scriptinit event {ID} = [param_id]; and it will edit the specific record.

[SOLVED] I think I found the solution

$vAID = 'Akt öffen ’ .{Akt_ID};
sc_link(Akt_ID, form_FF_Aktivitaeten_KL_single_var, v_Akt_ID={Akt_ID}, $vAID, “iframeR”);

v_Akt_ID must be defined as global variable in the WHERE field of the called form
like Akt_ID=[v_Akt_ID] and now it works

Thanks again for your help

1 Like