Announcement

Collapse
No announcement yet.

SC Redict Macro

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SC Redict Macro

    Hi all,

    it's a continue from a closed thread http://www.scriptcase.net/forum/show...m-record/page2
    Thanks for jsb's code and my code is 'half-working'

    My app http://sc.astudion.com/sc8/app/Virtu...nInterfaceAdd/ which suppose to redict to EmployeeMaster app
    http://sc.astudion.com/sc8/app/Virtu...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

  • #2
    my first suspect is because i execute sc_redirect macro in AfterInsert Event, my next Employee Master app still recognized it as 'add' mode

    Comment


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

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


      jsb

      Comment


      • #4
        Hi

        Jsb, it forced me to enter the e_id... which suppose to be enter via form
        http://sc.astudion.com/sc8/app/Virtu...trkih0j72&8159

        Comment


        • #5
          Originally posted by weilies View Post
          Hi

          Jsb, it forced me to enter the e_id... which suppose to be enter via form
          http://sc.astudion.com/sc8/app/Virtu...trkih0j72&8159

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

          Comment


          • #6
            Sorry, just a typo. See Albert's response.

            jsb
            Last edited by jsbinca; 09-19-2014, 10:07 AM.

            Comment


            • #7
              hi jsb & Albert,

              i have compile the errors i got based on different proposals given.
              https://docs.google.com/document/d/1...it?usp=sharing

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

              Kindly review.

              Thanks

              weilies

              Comment


              • #8
                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.

                Comment


                • #9
                  Good that it is solved. Hard to find here ;-)
                  Albert Drent
                  aducom software netherlands
                  scriptcase partner, reseller, support and (turn-key) development
                  www.scriptcase.eu / www.scriptcase.nl

                  Comment


                  • #10
                    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/Virtu...mployeeMaster/

                    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

                    Comment


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

                      Comment


                      • #12
                        Thanks! it's working now

                        Comment

                        Working...
                        X