DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Trying to load a SQl Query in an Action Form

 3 Replies
 1 Subscribed to this topic
 30 Subscribed to this forum
Sort:
Author
Messages
Growing Member
Posts: 67
Growing Member
New Poster
New Poster
Congrats on posting!

I am trying to load some data from a field into an Action Form via SQL but cannot do it.

Here's what I have so far:

* I have created a table with dummy data called 'dbo.DummyTable' and a dummy field called 'TestData' (there is only 1 field and 1 row at the moment).

* Inserted the SQL query under the events tab >> On Page Load >> Run SQL Query

      SELECT      TestData

       FROM        dbo.DummyTable
(eventually I will add a where clause and other conditions once it's working)

  • Created an Output text box called Output and a Dynamic Field Container called Output2 and tried using a Bind Expression on these: 
    [Output]==[TestData]
  • Also got the same SQL query on the submit button on the On Click Handler.


I think the Bind Expression might be just to show /hide or enable/disable a field based on conditions but I just want to make an area on the form whether that be a a text box or Dynamic Field to show the TestData field from my database, but nothing is working at the moment.
-any ideas?
(running DNN v 9.11 and Action Form v 5.21.6)

 

Veteran Member
Posts: 838
Veteran Member
3 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!

I think you are better of using Action Grid for this. You can create a list or grid, based on your SQL statement.

The Bind expression is indeed a rule that defines whether a field is shown or not. 

If you don't have action grid, you can use 2SXC (free) or Live visualizer (commercial)

Growing Member
Posts: 67
Growing Member
New Poster
New Poster
Congrats on posting!

thanks, we don't have Action Grid, at least not at the moment. 
Last time I looked at 2SXC I found it confusing and would rather steer clear of that at the moment if possible.

It was suggested that extracting columns might work (under Events >> On Page Load >> Extract Column, and using that as a token but that's not working at the moment either.

Growing Member
Posts: 67
Growing Member
New Poster
New Poster
Congrats on posting!

think I'm getting closer to a solution using "Create List from SQL" action and "For Each List Entry" , although I still cannot get it working.

Here's what I've got so far, 

1. Created an action form with a user text box to retrieve their input > Called "UserTxt"
2. On the submit btn of the form, I've used: "Create List from SQL
3. on the above SQL Query used - "SELECT MyField FROM dbo.MyDummyTable"
4. Given the list the name 'MyList', 
5. ADD >> Execute Actions For Each List Entry
6. ?  some conditions ?
7. Action List >> Display Message >> e.g. 'success message, match found'

I think the issue is around step 6?, perhaps its just a case of formatting the condition under Execute Actions? such as :

[ < MyList> == < UserTxt > ]
or
[ < MyList > : < MyField > ] == < UserTxt > ]

I have tried formatting the conditions in a variety of ways and even without any conditions but nothing happens either way - the display message is never shown. Am I missing something? or does it look OK, and in which case it might be just a formatting/typo issue?

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved