I have an app
http://sc.astudion.com/sc8/app/VirtualDesk/EmployeeMaster/
How can i tell SC to redirect and land into a specific record rather than always showing the first row?
Thanks
I have an app
http://sc.astudion.com/sc8/app/VirtualDesk/EmployeeMaster/
How can i tell SC to redirect and land into a specific record rather than always showing the first row?
Thanks
Why don’t you list your records in an editable view grid, and in that grid set up an application link to that form. Then you can click on the edit “pencil” to open that form with that specific record?
Due to the design of my app workflow, I need a REDIRECTION to a particular app with specific.record.
I.comb through macro doc but find no.way to do it
I am trying to modal a person master app, when the admin choose type=employee and save, sc should redirect to employee app with employee related fields, when admin select type=vendor and it will direct to vendor app.
That’s why I need a redirection to specific app, record bcoz my person search app should redirect to specific employee/vendor record.
I hope the gurus can hear me and let me know if it’s feasible in sc
Thanks
I think you should go to the onafterinsert event, test you admin field and do a sc_redir to the requested app? The needed employee can be passed in the parameters and will be available as a global var.
sc_redir(‘myapp’,globperson={myperson});
In you app you need to adjust the sql: where personid=[globperson]
[QUOTE=weilies;26943]I am trying to modal a person master app, when the admin choose type=employee and save, sc should redirect to employee app with employee related fields, when admin select type=vendor and it will direct to vendor app.
That’s why I need a redirection to specific app, record bcoz my person search app should redirect to specific employee/vendor record.
I hope the gurus can hear me and let me know if it’s feasible in sc
Thanks[/QUOTE]
Add on your form a WHERE clause.
employee=[glo_employee]
And on redir, you pass glo_employee as param
I thought he wants to still have the full navigation available, but that the form is opened on a specific record?
So its a form showing a single record of say 10 records. I assumed he wanted to be able to open that form on say record 5, but still be able to use nav bar to go go back and forth from there?
Adz1111 is exactly correct!
I need to “next” until the record rather to filter till one single rec
I’m not sure, but I think is not posible. mAYBE Playing with jacascript
Thanks Giu, to be honest, the more I dig sc the more I found it lack of some useful features I want. I really hope the developer can do something on it
I will wait for few more days for responses before go for other approaches
Thanks all for.the input
[QUOTE=weilies;26953]Thanks Giu, to be honest, the more I dig sc the more I found it lack of some useful features I want. I really hope the developer can do something on it
I will wait for few more days for responses before go for other approaches
Thanks all for.the input[/QUOTE]
I have been looking into some JQuery grids and did not find similar functionality. I found a MySQL routine to set the cursor though, but I haven’t been able to look how to use it within scriptcase, but perhaps it’s helpful: http://php.net/manual/en/function.mysql-data-seek.php. It would be helpful if mysql could set the cursor by a correct sql statement. As there’s a possibility to select a certain record page, you could look into the generated html page to see what SC is using to do the job. After all they are using JQuery.
But I can see why it’s a difficult issue. Pages have fixed sizes and if your record should be on top it would go wrong if you would scroll back to the first page.
appreciate if someover ever done this before can give some input
Thanks Albert for the suggestion but i guess SC’s selling point is to work natively with other DB engine, so my understanding is SC should have similar feature done in SC’s macro ‘seek’
Hold on guys. Even if I repeat myself.
SC is a toolbox for PHP programming (actually a good one) nothing more nothing less. So use it accordingly. Yes, I agree, it lacks some features but more importantly a good documentation.
But to be honest, it’s getting annoying to read more and more that if a problem couldn’t be solved by a macro or a mouse click, it’s a missing feature of SC.
End Of Rant!
Try this one:
As others already suggested, redirect to your form and pass the emplyee_id as parameter, but don’t use the Where clause.
I assume the form is ordered by employee_id, if not, you have to adjust the code accordingly.
onLoad event:
if([e_id] > 0)
{
go_to(); // create a PHP-method with this name
}
PHP-method (go_to):
$page_sql = "SELECT page FROM (SELECT @rownr := @rownr + 1 as page, employee_id
FROM employee, (SELECT @rownr := 0) r
Order by employee_id) tab1
WHERE employee_id = [e_id]";
sc_lookup(rs,$page_sql);
if(isset({rs[0][0]}) && {rs[0][0]} > 0)
{
[e_id] = 0;
sc_ajax_javascript('nm_navpage',array({rs[0][0]},'P'));
}
This should give you the effect you want.
jsb
Edit: I forgot to mention the ‘Jump to’ button has to be on the toolbar.
[QUOTE=jsbinca;26959]Hold on guys. Even if I repeat myself.
SC is a toolbox for PHP programming (actually a good one) nothing more nothing less. So use it accordingly. Yes, I agree, it lacks some features but more importantly a good documentation.
But to be honest, it’s getting annoying to read more and more that if a problem couldn’t be solved by a macro or a mouse click, it’s a missing feature of SC.
End Of Rant![/QUOTE]
Agree. Seems like a lot of people wants to do all just with one click.
Try this one:
As others already suggested, redirect to your form and pass the emplyee_id as parameter, but don’t use the Where clause.
I assume the form is ordered by employee_id, if not, you have to adjust the code accordingly.
onLoad event:
if([e_id] > 0)
{
go_to(); // create a PHP-method with this name
}
PHP-method (go_to):
$page_sql = "SELECT page FROM (SELECT @rownr := @rownr + 1 as page, employee_id
FROM employee, (SELECT @rownr := 0) r
Order by employee_id) tab1
WHERE employee_id = [e_id]";
sc_lookup(rs,$page_sql);
if(isset({rs[0][0]}) && {rs[0][0]} > 0)
{
[e_id] = 0;
sc_ajax_javascript('nm_navpage',array({rs[0][0]},'P'));
}
This should give you the effect you want.
jsb
Edit: I forgot to mention the ‘Jump to’ button has to be on the toolbar.
Something like this is similar of what I thought. Look what JS jumps and call it
Great solution,
Indeed a good solution. I have to agree on the other part too.
Thanks jsbinca for providing a working code.
In the first place, may i know how you manage to know there is such ‘nm_navpage’ function exist? and the required parameter ‘P’?
Hope you can share the relevant doc from SC.
Thanks
There is basically no doc for all the javascript functions used in scriptcase (which is a shame).
All you can do is dive into the generated code/page and try to figure out how things work and what functions are used.
In some cases (like this one) it is a bit easier and you can see the function called by hovering your mouse over an object (button).
jsb
Thanks for the GREAT help from the community!