Announcement

Collapse
No announcement yet.

MACRO sc_apl_conf() NOT WORKING

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

  • MACRO sc_apl_conf() NOT WORKING

    Since I have no help or response I'm posting it here because there seems to be something wrong either with this Macro or Scriptcase IDE. I tested this in every possible way and I cannot simply get this macro to work. I have had exactly the same problem some time ago. I could not resolve it for 2-3 weeks. I gave up for some time and moved on to another part of the project. At some point the same code I have had started working, despite I have not changes a single line of code. I do not know what is causing it but I cannot spend months on such simple thing.

    The process is to simply call a FORM which
    1. adds a single record to the table (if it does not exists)
    OR
    2. modifies existing record if it does exist



    Here is the code I use in the MENU
    PHP Code:
    if ({sc_menu_item} == "item_1")
    {
        
    $query1 "SELECT UID, companyname FROM g_systemsettings WHERE UID=1";
        
    sc_select(dataset$query1);

        if (
    false == {dataset})
            {
                
    // Record not found
                
    sc_alert("mode - NEW");
                
    sc_apl_conf ("m_g_config""start""new");

            }
        elseif ({
    dataset}->EOF)
            {
                
    // Record found
                
    sc_alert("mode - UPDATE");
                
    sc_apl_conf ("m_g_config""update""on");

            }
        else
            {
                
    // Error
                
    sc_alert("Unknown Error");
                
            }

    menu_item.png


    none of the messages show up on the screen. I even went further and removed some code leaving only this:

    PHP Code:
    if ({sc_menu_item} == "item_1")
    {
                 
    sc_alert("test");
                
            } 
    and the alert message does not show up!
    I have another menu where similar code works (although it is not exactly the same).

    I tried to remove temp files, _lib files, clear browser cache and cookies,...but nothing works.
    I also run SC in Google Chrome, regenerated the whole project and run the App. The same result :-(


    PS> Admin - please remove initial message fomr the general section. TNX
    Last edited by aka; 05-18-2016, 02:33 AM.
    -----------------------------------------
    Arthur Klisiewicz
    dATA POINT SOFTWARE
    www.datapointsoftware.com

  • #2
    I told you several times. You CAN'T stop a PHP process with an sc_alert, check macros doc to see where you can use it. This is the reason you don't see the alert.

    About the problem, you just have to use:
    sc_apl_conf ("m_g_config", "start", "new");

    If you want to open in edit mode, just don't call apl_conf, is not needed because is the default behaviour. apl_conf with update_mode, AFAIK, is just to "hide" the update button of a form.

    Then, your code should be something like:
    PHP Code:
    if ({sc_menu_item} == "item_1")
    {
        
    $query1 "SELECT UID, companyname FROM g_systemsettings WHERE UID=1";
        
    sc_select(dataset$query1);

        if (
    false == {dataset})
            {
                
    // Record not found
                
    sc_apl_conf ("m_g_config""start""new");

            }
        else
            {
                
    // Error          
            
    }

    I move outside bugs subforum.
    Last edited by Giu; 05-18-2016, 06:05 AM.
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      OK, Giu, I will try your suggestion and report back here. /Thanks
      BTW. so what's the best way to do some testing (i.e. I want to display a string or Var here) if you say sc_alert() would not work here ?
      let's say I want to display message in an /Error line - should sc_error_message("Text") - work ?


      ARTHUR
      Last edited by aka; 05-18-2016, 04:17 PM.
      -----------------------------------------
      Arthur Klisiewicz
      dATA POINT SOFTWARE
      www.datapointsoftware.com

      Comment


      • #4
        For testing/debug I created a Little function to write on an html file to see var values, but I'm not in front of a PC
        /Giuseppe

        Professional Scriptcase Services
        Some Customers opinions

        Comment


        • #5
          Damn phone. I will share in my morning
          /Giuseppe

          Professional Scriptcase Services
          Some Customers opinions

          Comment


          • #6
            Originally posted by aka View Post
            OK, Giu, I will try your suggestion and report back here. /Thanks
            BTW. so what's the best way to do some testing (i.e. I want to display a string or Var here) if you say sc_alert() would not work here ?
            let's say I want to display message in an /Error line - should sc_error_message("Text") - work ?


            ARTHUR
            http://scriptcasers.com/simple-way-d...es-scriptcase/
            /Giuseppe

            Professional Scriptcase Services
            Some Customers opinions

            Comment


            • #7
              It is still not working. No matter what I do the form opens up in INSERT mode. I'm able to add first record (if none exists) but the form does this by going into INSERT mode. Then each SAVE causes duplicate record error or adds new record. There is no way to edit existing record. I tried to read the record nr.1 in "OnLoad" even but doesn't help as well. By looking at the code in the forst post there seem to be only 2 posibilities.
              1- the line: if (false == {dataset}) for some reason is always TURE
              2. macro is not working (at least the EDIT mode is not)

              I wonder if somebody could confirm if this works:
              PHP Code:
               sc_apl_conf ("myapp""update""on"); 


              Last edited by aka; 05-20-2016, 01:41 PM.
              -----------------------------------------
              Arthur Klisiewicz
              dATA POINT SOFTWARE
              www.datapointsoftware.com

              Comment


              • #8
                I REALLY WANT NETMAKE TO IMPLEMENT SOME FORM MODE INDICATOR (variable) THAT WE CAN EASILY TEST WHILE RUNNING APPS
                -----------------------------------------
                Arthur Klisiewicz
                dATA POINT SOFTWARE
                www.datapointsoftware.com

                Comment


                • #9
                  Giu - I posted this into BUGS. You moved this post out of that section. For over 2 weeks I keep trying to get some help on this and no response. I'm getting really upset about all this. Why don't you send a sample here so we can see this works. If there is no example I see it as BUG! (unless somebody confirm it works). I will extract the table an 2 Apps necessary to test it and post it back here.
                  -----------------------------------------
                  Arthur Klisiewicz
                  dATA POINT SOFTWARE
                  www.datapointsoftware.com

                  Comment


                  • #10
                    Sorry Arthur, I was very busy.

                    1- the line: if (false == {dataset}) for some reason is always TURE
                    I can't help here without debugging.

                    2. macro is not working (at least the EDIT mode is not)
                    Form has not any edit mode. By default, a form is in edit mode always.

                    Well, I moved outside Bug subforum until confirmed if it's really a bug or not (because all tests was succesfully)
                    I tried a lot apl_conf without any issues

                    I move again into bugs, to be considered by John L. Santos or Cavadinha but because you set the form to be in ADD mode, is the expected behaviour IMHO. The problem is the lack of a way to exit from this mode.

                    Said that, apl_conf is not needed for what you need.

                    image_2927.png image_2928.png image_2929.png
                    Last edited by Giu; 05-24-2016, 05:22 AM.
                    /Giuseppe

                    Professional Scriptcase Services
                    Some Customers opinions

                    Comment


                    • #11
                      Giu thanks for your time.

                      Your suggestion does not work. I tried it already some time ago. The problem is that when I use your method on return from the form my menu opens twice (or I should say kinda on top of another). The effect is that I have two vertical menus sitting one under another. The problem here is that there is no way to add _parent attribute (where you red arrow is). I can use this attribute in "OnValidate" event and that solves this problem.
                      Forget about the RETURN issue because I got this managed.

                      The issue with calling single form is still unresolved. I just got an email from NetMake but they of course did not read my info carefully claiming it is working. The problem is that they call this macro from "OnLoad" even, and they use
                      HTML Code:
                      sc_apl_config("myapp", "insert", "off")
                      when I try this I get error on on opening/loading the record (ERROR: No records found").

                      If your statement (the form has no edit mode" is TRUE() then why they have macro ?
                      HTML Code:
                      sc_apl_conf ("myapp", "update", "on");

                      the whole concept with this is f...up! If they have used global Var's like I suggested it would be so much easier to manage all forms.

                      HERE ARE THE STEPS TO REPRODUCE THE ISSUE
                      1. Create a table with PK (i.e UID(Int). This table will always have only one record.
                      2. Create vertical menu and assign an item (i.e SETTINGS)
                      3. Create a form to edit table (from step 1)
                      4. Call this form from the menu by using "OnExecute" event
                      5. In case the record exists the form should open in EDIT mode, if it doesn't exist it should open in INSERT mode.
                      Last edited by aka; 05-24-2016, 12:54 PM.
                      -----------------------------------------
                      Arthur Klisiewicz
                      dATA POINT SOFTWARE
                      www.datapointsoftware.com

                      Comment


                      • #12
                        I sent you in Skype some apps (is an apps export, not a project, but import on a new project to avoid name conflicts), and an SQL to recreate the table. It works for me (if I understand the problem) adapt to your needs and report back to me what's not working. WHERE is hardcoded, take into consideration to see whats the next ID value for your testing.
                        /Giuseppe

                        Professional Scriptcase Services
                        Some Customers opinions

                        Comment


                        • #13
                          when I try this I get error on on opening/loading the record (ERROR: No records found").
                          because this disable the insertion on the form. It's the same if you move your insert button out of toolbar. Form will not enter on Insert mode if no records found.

                          If your statement (the form has no edit mode" is TRUE() then why they have macro ?
                          HTML Code:
                          sc_apl_conf ("myapp", "update", "on");
                          Because this disable update button. Difference with sc_button_display, is that you can apply modifications on forms based on roles with apl_conf, from a login FORM for example. sc_button_display should be used in every app directly.

                          HERE ARE THE STEPS TO REPRODUCE THE ISSUE
                          1. Create a table with PK (i.e UID(Int). This table will always have only one record.
                          2. Create vertical menu and assign an item (i.e SETTINGS)
                          3. Create a form to edit table (from step 1)
                          4. Call this form from the menu by using "OnExecute" event
                          5. In case the record exists the form should open in EDIT mode, if it doesn't exist it should open in INSERT mode.
                          This is the example I created and send you by skype (don't have your email).
                          /Giuseppe

                          Professional Scriptcase Services
                          Some Customers opinions

                          Comment


                          • #14
                            OK, so if I understand you correctly this macro does not change a form mode but rather enable/disable buttons on the form - is that correct ?
                            -----------------------------------------
                            Arthur Klisiewicz
                            dATA POINT SOFTWARE
                            www.datapointsoftware.com

                            Comment


                            • #15
                              Originally posted by aka View Post
                              OK, so if I understand you correctly this macro does not change a form mode but rather enable/disable buttons on the form - is that correct ?
                              Yes and no. Forms has 2 states. Normal (for updates) or inserts. By default, a form always open a record for update. If table has no records under SQL criteria, open directly for new record.
                              There are situations where you don't have records but you don't want to enter on insert mode either, and there are situations where you have records but you want to force to enter new record.

                              "update", "on", I guess, hide update button, is the same that disable update mode (because there is no button, you can't save).
                              "insert", "off" hide insert button, is the same that disable insert mode (because there is no button, you can't insert).
                              "start", "new", says to the form to go into mode for enter new records, but, if you have an "insert", "off", because insert is disabled, will not enter on insert mode.

                              Move update or insert buttons outside toolbar, does the same. Difference? Imagine you want to disable update button for some specifics forms. Hiding buttons does the job, but you have to write your logic in every app. with apl_conf you can iterate over affected apps with your logic from one place, and will affect to complete project over the session.

                              Control of all of this could be better, of course, but right now works as is and more or less makes sense. For this reason, IMHO, is more a suggestion than a bug, but maybe, I miss something in my tests.

                              This was my research, maybe something is wrong, I did a lot of tests, and don't remember exactly every situation/combination
                              Last edited by Giu; 05-25-2016, 04:28 AM.
                              /Giuseppe

                              Professional Scriptcase Services
                              Some Customers opinions

                              Comment

                              Working...
                              X