Announcement

Collapse
No announcement yet.

[SOLVED] How to land on a specific form record?

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] How to land on a specific form record?

    I have an app
    http://sc.astudion.com/sc8/app/Virtu...mployeeMaster/

    How can i tell SC to redirect and land into a specific record rather than always showing the first row?

    Thanks

  • #2
    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?

    Comment


    • #3
      Originally posted by adz1111 View Post
      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

      Comment


      • #4
        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

        Comment


        • #5
          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]
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            Originally posted by weilies View Post
            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
            Add on your form a WHERE clause.

            employee=[glo_employee]

            And on redir, you pass glo_employee as param
            /Giuseppe

            Professional Scriptcase Services
            Some Customers opinions

            Comment


            • #7
              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?

              Comment


              • #8
                Adz1111 is exactly correct!
                I need to "next" until the record rather to filter till one single rec

                Comment


                • #9
                  I'm not sure, but I think is not posible. mAYBE Playing with jacascript
                  /Giuseppe

                  Professional Scriptcase Services
                  Some Customers opinions

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      Originally posted by weilies View Post
                      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
                      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.
                      Last edited by aducom; 09-10-2014, 11:47 AM.
                      Albert Drent
                      aducom software netherlands
                      scriptcase partner, reseller, support and (turn-key) development
                      www.scriptcase.eu / www.scriptcase.nl

                      Comment


                      • #12
                        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'

                        Comment


                        • #13
                          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:
                          Code:
                          if([e_id] > 0)
                          {
                          	go_to(); // create a PHP-method with this name
                          }
                          PHP-method (go_to):
                          Code:
                          $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.
                          Last edited by jsbinca; 09-10-2014, 01:50 PM.

                          Comment


                          • #14
                            Originally posted by jsbinca View Post
                            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!
                            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:
                            Code:
                            if([e_id] > 0)
                            {
                            	go_to(); // create a PHP-method with this name
                            }
                            PHP-method (go_to):
                            Code:
                            $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,
                            /Giuseppe

                            Professional Scriptcase Services
                            Some Customers opinions

                            Comment


                            • #15
                              Indeed a good solution. I have to agree on the other part too.
                              Last edited by aducom; 09-10-2014, 02:28 PM.
                              Albert Drent
                              aducom software netherlands
                              scriptcase partner, reseller, support and (turn-key) development
                              www.scriptcase.eu / www.scriptcase.nl

                              Comment

                              Working...
                              X