Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By sgkalluri
#790255
Hello there,

I experimented by writing dynamic sql queries in a Dynaform in the following way:

1. Defined a textbox field 'SearchString' in a Dynaform. This would hold the text content for a sql query.

2. Defined another textbox field 'SearchResult' in the same Dynaform. Defined its sql control as @=SearchString. This is to ensure that the contents of SearchString get transferred to SearchResult, and hopefully fire the sql query of SearchResult.

3. E.g. SearchString could be defined as "select abc from def where xyz = 'ijk' ". This should populate the sql query parameter of SearchResult, fire the sql query content "select abc from def where xyz = 'ijk' ", and provide the corresponding result.

4. By this way, I could change the sql string in SearchString, using Javascript based on selected conditions, to anything else which is valid and see the corresponding result in SearchResult.

Here is what happened:

a) This worked fine in the designer environment of the Dynaform. No issues there.

b) However, the same config did not work in runtime environment. The queries did not fire when logged in as a user.

I am wondering why this happened - worked in designer environment, but did not work in runtime.

Any help would be useful.

Many thanks in advance,
SGK
By mishika
#790263
Hello,

I checked the scenario you have stated. I created a process for the same and it worked perfectly fine for me at both the places in Preview and at Runtime.

I have shared the process here.
(23.5 KiB) Downloaded 410 times
In the process, there is a Dynaform which has 2 text field, as you enter a SQL query in the first field the second text field gets populated with its result.
May you please test the process and let me know if it works fine for you?

Hope this helps

Best Regards
Mishika
By sgkalluri
#790264
Thanks Mishika. Looks like it is working fine.

The scenario that I was working with turned out ok too after I changed the SearchResult variable to a dropdown control instead of a textbox control, and also gave the sql query as something like this...

select (@=SearchString) key01, 'Done' label01 from abc limit 1

Here, getValue() of SearchResult would give the result of the query, and its getText() would give the value 'Done'.

Thanks for your help.

Best wishes
SGK

Are you looking for a more intelligent approach to[…]

The 1Win Clone Script is a pre-built solution that[…]

Aviator Clone Script replicates the renowned Aviat[…]

From converting physical assets into digital asset[…]