Auto Fill In -> search chain

  • Robert B.
        Has successfully completed the online course Basics (100)
      9 months ago #45685

      edit englisch version below

      ———————-

      Ein Problem habe ich momentan das ich nicht lösen kann… ich habe ein Eingabefeld in dem ich eine Nummer eintrage… sobald das Feld eingetragen ist und enter gedrückt wurde wird auch eine SQL abfrage getättigt. Wenn ich aber nun die Kette verlänger um die nächste SQL abfrage werden meine Felder nicht ausgefüllt. ich muss jede SQL abfrage manuell anstoßen mittels “Knopfdruck”. Habe auch versucht am ende mittels “UI Aktion” eine Variable/Event auf True zu setzten und diese in den start der nächsten Kette eingebaut. egal wie, sobald ich die SQL Fragen einzeln mittels Knopfdruck abfrage geht es. SObald ich die in einer Kette mache, geht es nur bis zur ersten SQL abfrage. der skript der nach der SQL abfrage kommt ist folgender :

      this.getGlobals().setVar(“Result_SQL”, data.result.result[0]);
      //this.setItemValue(“Screen_addTodo”, “Input_bezeichnung”, “value”, sachnummerBezeichnung);

      console.log(data.result.result[0]);
      console.log(OberstAuftrag);

      damit soll nur die Variable gesetzt werden, welche bei den output feldern angesteuert sind. das musste ich so machen da ich das outputmapping der sql abfrage nicht anderes direkt machen konnte. sobald die output parameter in eine variable geschrieben werden sollten´ging das nicht. aber über den script schon ?????!!!!

      wäre toll wenn mir da einer helfen kann das ich diese hilfkonstrukt von such knöpfen weg habe und einfach nur wenn die Seriennummer eingetragen wird die anderen felder automatisch ausgefüllt werden….

      danke an alle

       

      ———————

       

      I currently have a problem that I can’t solve… I have an input field in which I enter a number… as soon as the field is entered and enter is pressed, an SQL query is also executed. But if I now extend the chain to the next SQL query, my fields are not filled in. I have to trigger each SQL query manually by “pressing a button”. I also tried to set a variable/event to true at the end using “UI action” and included it in the start of the next chain. no matter how, as soon as I query the SQL questions individually by pressing a button, it works. As soon as I do them in a chain, it only works up to the first SQL query. the script that comes after the SQL query is the following :

      this.getGlobals().setVar(“Result_SQL”, data.result.result[0]);
      //this.setItemValue(“Screen_addTodo”, “Input_name”, “value”, item_numberName);

      console.log(data.result.result[0]);
      console.log(OberstAuftrag);

      this should only set the variable which is controlled by the output fields. i had to do it this way because i couldn’t do the output mapping of the sql query directly. as soon as the output parameters should be written to a variable, it didn’t work. but via the script already ?????!!!!

      it would be great if someone could help me to get rid of this auxiliary construct of search buttons and simply fill in the other fields automatically when the serial number is entered….

      thanks to all

      • This topic was modified 9 months ago by Robert B..
      Attachments:
      You must be logged in to view attached files.
      Armin Winkler
          Has successfully completed the online course Introduction
          Has successfully completed the online course Intermediate (200)
          Has successfully completed the online course Advanced (300)
          Has successfully completed the online course Basics (100)
        9 months ago #45693
        Up
        0
        Down
        ::

        Hi Robert,

         

        in order for our non-German speaking users to be able to understand, too, I’m going to formulate my reply to your query in English, thank you for your understanding.

         

        If I understand your problem correctly, you have several SQL-based connector calls which provide you with the data to populate the fields inside of a form. Depending on the input of a certain serial number field, you perform a connector call that outputs data which should be saved into a (most likely struct) variable. As soon as you want to run another call which takes the serial number as input to fetch a additional kind of data set which should finally appear in various other form fields, the call is not executed anymore. Is that correct?

         

        While I don’t really understand based on your description, how the following connector calls are not carried out (and I think this circumstance would require a separate, thorough analysis), I would recommend you to restructure your process flow and implement a server-side business object instead of several subsequent connector call activities. Your scenario is a prime example for the usage of a server-side business object indeed, as inside of one of its functions you would be able to combine several connector calls invoked via Javascript (JS) API calls and merge and / or modify the individual results. Finally, you could set your results to predefined output parameters and use them in the output mapping dialog to map values to the existing form fields in your UI. In particular, the problem which you solved via script, which is that SQL connector calls per default output a result set (i.e. an array of objects), can be handled in the JS code of the business object function as well, as you could implement a check on existence of an element inside of the result set of the given connector call (i.e. the array length has to be greater than 0), and then just set the single output element (i.e. index 0 of the array as seems to be the case for your scenario) as value to an output parameter which has a struct data type assigned to it. Please find the documentation for server-sided business objects here. You most likely will need the API documentation as well if you are to execute connectors from inside of your function.

         

        Should you decide to stick with your current process logic implementation which relies on connector call activities solely, please speak with the person responsible for Simplifier in your company and let them create a ticket in our support portal on your behalf asking for further help and error analysis of your application. We would then be able to help you further in the frame of an Enabling session based on a paid contingent from your company.

         

        Good luck adapting your application logic and please let us know whether this helped you.

         

        Kind regards,

         

        Armin

        • This reply was modified 9 months ago by Armin Winkler.
        Robert B.
            Has successfully completed the online course Basics (100)
          9 months ago #45698
          Up
          0
          Down
          ::

          Nearly Correct:

          1. put SN into input field nad hit enter (submit)

          2. SQL Query search for where is SN deliver Ordernumber (connector call)

          4. script takes result of this query and put it into a global value (script)

          5. Output field is assigned with that global value (UI action)

          now the problem… the text above is in the process designer a chain… and i want to fill in another output field based on the value of the output field ordernumber using another sql query. Then the next field based on the previous field.

          the process chain also works when it completes on its own. if you connect the chains you only get to the first script. so that only the order number is picked out but all other fields remain empty…

          but i don’t want to press a new button every time just to start a data query. i tried it with variables also with events but it doesn’t seem to start then… or is too fast one after the other so that the first field is still empty when the query starts… maybe a wait loop of half a second can help but i’m not good at that either because javascript is apparently not as easy as you sometimes imagine 😉

          Unfortunately I can’t implement the BO because I don’t really know JavaScript… The script I use is a modification of a colleague who uses it in Simplifier, he also got it from someone else. (i one change the variable name)

          Lukas Henninger
              Has successfully completed the online course Introduction
              Has successfully completed the online course Intermediate (200)
              Has successfully completed the online course Advanced (300)
              Has successfully completed the online course Basics (100)
              Has successfully completed the online course Advanced (310)
              Has successfully completed the online course Advanced (320)
            8 months ago #46426
            Up
            0
            Down
            ::

            Hi Robert,

            I do not think a wait loop is a really reliable way to ensure the execution is finished. There can be a multitude of reasons, why the set wait time could be exceeded, thus failing again. Additionally, this would also lead to excessive waiting times.

            As Armin already mentioned, I also suspect there is some sort of error, which intererupts the execution of the chain.

            You could try to modify the result of your connectors . In the following picture you can see an additional output parameter calles “firstResult” which contains the first result. You may be able to map this single result to your variables, which would make the following scripts obsolete.Modified Output of a SQL Connector

            If you devide to go the route of a SSBo, you can find a bit more information about them here.

            In General this is a relatively simple task to achieve. However, there are a few caveats to watch out for.

            First, you would need to create a new SSBO and add the connector to  it. (or Reuse an exisiting one)
            For creating of the SSBO, follow the steps I linked above. Afterwards, you can add a connector by editing the BO using the edit Button next to the view/delete buttons just below the +(create) button.
            Now you should be in a view, where you can edit the description, change associated projects and add/remove connectors, business objects and plugin.

             

            The Business Object itself would look something like this:
            input parameter: SN -> int (if it is a number)
            output parameter: mat -> your data structure, if applicable, or simply any
            Code:

            var oAuftrag = Simplifier.Connector.BLN_CMT_SQL_DEV.search_SN({: input.SN}).
            Var oMat = Simplifier.Connector.BLN_CMT_SQ_DEV.searchMatNR_Import(: Auftrag.id}).

            output.mat = oMat;

            And so on for the other two connector calls.

            You will need to change the input of the connector call to match your parameters. This depends on the definition of the call in your connector.
            By default the sql-connector retrieves a list of results called result. If you want to acces the first result, you would need to change the call as follows:
            var yourFirstResult = Simplifier.Connector.BLN_CMT_SQL_DEV.search_SN({: input.SN}).result[0]
            This is basically the output parameter you used accessed via the script before.

            I have attached a transport to this post, which contains a simple example.

             

            Kind regards

            Lukas

            • This reply was modified 8 months ago by Lukas Henninger. Reason: Typos
            Attachments:
            You must be logged in to view attached files.
          Viewing 4 posts - 1 through 4 (of 4 total)

          You must be logged in to reply to this topic.