SC Redict Macro

Hi all,

it’s a continue from a closed thread http://www.scriptcase.net/forum/showthread.php?6947-SOLVED-How-to-land-on-a-specific-form-record/page2
Thanks for jsb’s code and my code is ‘half-working’

My app http://sc.astudion.com/sc8/app/VirtualDesk/PersonInterfaceAdd/ which suppose to redict to EmployeeMaster app
http://sc.astudion.com/sc8/app/VirtualDesk/EmployeeMaster on a particular Person’s row
but strange thing is, when it land to Employee Master, it initialized to Insert mode (missing navigation)

Kindly advice

Thanks

my first suspect is because i execute sc_redirect macro in AfterInsert Event, my next Employee Master app still recognized it as ‘add’ mode

You have to pass the employee/person id with your redirect.
onAfterInsert:

sc_commit_trans();
sc_redir(master_app,[e_id]={person_id});

jsb

Hi

Jsb, it forced me to enter the e_id… which suppose to be enter via form
http://sc.astudion.com/sc8/app/VirtualDesk/PersonInterfaceAdd/PersonInterfaceAdd_teste.php?nmgp_outra_jan=true&nmgp_start=SC&script_case_session=3sm1s1l0dl193so5ltrkih0j72&8159

[QUOTE=weilies;27302]Hi

Jsb, it forced me to enter the e_id… which suppose to be enter via form
http://sc.astudion.com/sc8/app/VirtualDesk/PersonInterfaceAdd/PersonInterfaceAdd_teste.php?nmgp_outra_jan=true&nmgp_start=SC&script_case_session=3sm1s1l0dl193so5ltrkih0j72&8159[/QUOTE]

The variable will become available as [e_id] in the called application. You can just use e_id without [] in the calling application: sc_redir(master_app,e_id={person_id});

Sorry, just a typo. See Albert’s response.

jsb

hi jsb & Albert,

i have compile the errors i got based on different proposals given.
https://docs.google.com/document/d/193_wki874J33-fCd7Lx3qCMTFTkMxa5zerKwPH25mnE/edit?usp=sharing

It’s not working yet even with your proposed solution.

Kindly review.

Thanks

weilies

hi all,

sorry for the confusion

My previous code is
sc_redir(EmployeeMaster, e_id={person_id});

The correct should be
sc_redir(EmployeeMaster, e_id={person_id});

Where the “)” previously was typed in CHINESE “)” character, that’s why it doesn’t work.

Good that it is solved. Hard to find here :wink:

Thanks all, with the helps, i can redirect and show the particular row correctly.

But here is another issue, it shows an ugly screen, prompting for global variable when i access following app directly.
http://sc.astudion.com/sc8/app/VirtualDesk/EmployeeMaster/

It doesn’t show the FIRST record even when i tried to add following commands to init them

	[gPersonId] = 0;
	[gPersonType] = '';

How to achieve both logic below?

  1. Person app > Master app > show the particular row (done)
  2. Directly access Master app > show first row

Hi,
since we don’t know where you use those variables here is something to try.

Go to onScriptInit:
if(!isset([gPersonId]) || empty([gPersonId]))
{
[gPersonId] = 0;
}

if(!isset([gPersonType]))
{
[gPersonType] = ‘’;
}

Next navigate to Application -> Global Variables and set both variables to type Out.

jsb

Thanks! it’s working now :slight_smile: