The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Request returned no data.
Posted: 27 Nov 06 1:25 PM
|
fiogf49gjkf0d I have a template with a corresponding action and I get this error when the action is suppose to fire:
Request returned no data.
The action is a simple update to the database. Is there something that I'm doing wrong in my actions? Is an action suppose to return data? |
|
|
|
Re: Request returned no data.
Posted: 28 Nov 06 1:40 PM
|
fiogf49gjkf0d Request returned no data suggest that once the action has been processed, you haven’t told it what to do next. i.e. in your action you should have something like this DoTemplate("conmain")
if you are telling it to go to page xxx then you may have the wrong name --- Duncan
|
|
|
|
Re: Request returned no data.
Posted: 28 Nov 06 1:47 PM
|
fiogf49gjkf0d Originally I didn't have the DoTemplate("conmain") in the action, so I added it. Now, before it can display the message, it redirects to the page and the data in the db still isn't being updated. |
|
|
|
Re: Request returned no data.
Posted: 28 Nov 06 1:54 PM
|
fiogf49gjkf0d I would strip out you code and just have the Dotemplate, if that works then start add the bits back in one by one. If you have error loggin enabled, you can use print to write to the application log to check you variables |
|
|
|
Re: Request returned no data.
Posted: 28 Nov 06 2:54 PM
|
fiogf49gjkf0d Corey,
If you post your code (at least the relevant parts), we might be able to help you a bit more.
Other than that, Duncan's suggestion of adding in things piece by piece would be your best bet.
Jeff
|
|
|
|
Re: Request returned no data.
Posted: 28 Nov 06 4:37 PM
|
fiogf49gjkf0d Here's the code: (keep in mind that I'm new at this and I am trying to make it update a record that I know will be effected before I move onto bigger stuff)
Sub Main
LogixClearError
Dim vsql As String Dim crHandle As String Dim temp As String temp = "Q6UJ9A0004MJ" 'this is the record that I want to be changed
crHandle = CreateRecord("UPDATE HS_ACCT_GMPROFILES") RecordAddCondition crHandle, "HS_ACCT_GMPROFILESID", "=", temp RecordAdd crHandle, "REFERENCE", "Test Web Reference" 'it will change whatever is in Reference with Test Web Reference, or at least in theory PostRecord(crHandle) DoTemplate "hsprofilescontact"
End Sub |
|
|
|
Re: Request returned no data.
Posted: 28 Nov 06 5:01 PM
|
fiogf49gjkf0d Corey,
A couple of questions/suggestions. It's probably item 1 or 2 that's causing your issue. Everything looks good to me logic wise.
1) On the "RecordAddCondition" line, is the "HS_ACCT_GMPROFILESID" an alias name or column name? It should be an alias that points to that field, not the database column name. If your alias is named the same as the field, it's no issue. For no particular reason (who knows why; I've always done it that way), my aliases usually are named differently than my field names. The documentation (at least for 6.2.3) doesn't make this clear, but it should be an alias.
2) On the RecordAdd line, "REFERENCE" should be an alias as well. If you want, you can use "RecordAddCustom", in which case "REFERENCE" could be the field name instead of an alias. The Web DevRefGuide suggests using RecordAdd whenever possible, so, in your case, just make sure "REFERENCE" is an alias to the database column in question.
3) Regarding the DoTemplate: if hsprofilescontact is a detail template (not a query template), you'll need a RequestSetValue statement similar to this: RequestSetValue "id", temp
where "temp" is the primary key for the table (it looks as if temp is your PK). That will set a name/value pair on the URL in the format of "&id=ABCDEFGHIJKL". Whenever the web DLL encounters the value "id=" on a URL requesting a detail template, it looks for the record on the main table for the template with that ID. It's basically how the template knows what data to substitute on your <#FIELD> tags.
4) I don't think it's causing an issue, but you can just do: "PostRecord crHandle". If you're doing an update, you don't get anything back. If you are inserting, though, and do something like: strNewID = PostRecord(crHandle), strNewID will be populated with the value for the inserted ID.
5) I usually Dim handles as a "Long". If you print out the value of a handle, it's numeric. Everything in the web actions is so loosely typed that it doesn't matter, but just a suggestion.
Without actually trying your code, it looks OK, as long as you have aliases instead of column names for the RecordAddCondition and RecordAdd statements. From what I see, that's the most likely suspect.
Jeff
|
|
|
|
Re: Request returned no data.
Posted: 29 Nov 06 9:32 AM
|
fiogf49gjkf0d Jeff,
I made the changes to the query as you recommended. Now the code looks like this:
Sub Main
LogixClearError Dim vsql As String Dim crHandle As Long Dim temp As String temp = "Q6UJ9A0004MN"
crHandle = CreateRecord("UPDATE HS_ACCT_GMPROFILES") RecordAddCondition crHandle, "gmhsaccgmid", "=", temp RecordAdd crHandle, "gmreference", "Test Web Reference" PostRecord(crHandle) End Sub
Still the error: Request returned no data. Could it be related to something else (ex. the template calling the action)?
|
|
|
|
Re: Request returned no data.
Posted: 29 Nov 06 9:54 AM
|
fiogf49gjkf0d Cory
That looks fine to me are you sure the data not been updated? The reason I ask is the error is not related to the "UPDATE" it's related to the page you want to go to next, which you haven't defined. i.e Dotemplate("MYNEXTPAGE") -- Duncan
|
|
|
| |
|
Re: Request returned no data.
Posted: 29 Nov 06 10:05 AM
|
fiogf49gjkf0d Do you have a trimmed down copy of your template page just containing your form? can you let me know what user you are using and there user type i.e. WebUser WebViewer? Finally are there any errors in the event log |
|
|
|
Re: Request returned no data.
Posted: 29 Nov 06 10:15 AM
|
fiogf49gjkf0d Just checked the event logs. There were two errors:
1. Unable to retreive ConnectionMgr object from SlxSystem object. 2. ConnectionString has not been set. Please check that you have the correct DB alias defined in the SlxSearchService.Ini file.
How do I fix these errors?
Also, I will get you the other info shortly. |
|
|
|
Re: Request returned no data.
Posted: 29 Nov 06 10:20 AM
|
fiogf49gjkf0d Here is the other info that you requested:
user: Admin type: Administrator
This form has just one button and the purpose is just to update the one test record. Once that is working, I am going to add more fields and make a real page out of it, wanted to get it working first.
<form name="mainform" action="<#SYS name=swcpath>/action?name=editprofilesaccount" method="POST"> <table> <tr> <td><input type="submit" value="Save"></td> </tr> </table> </form> |
|
|
|
Re: Request returned no data.
Posted: 29 Nov 06 10:32 AM
|
fiogf49gjkf0d Cory, those error in the event log are unrelated All looks good, can you add this to your action and try it again DoTemplate("blank") |
|
|
|
Re: Request returned no data.
Posted: 29 Nov 06 10:39 AM
|
fiogf49gjkf0d Boy do I feel stupid - I just noticed that one of my aliases got deactivated, reactivated it and bingo, it saved. Added DoTemplate("blank") and no error. Thanks for all your help. Sorry about the stupidity on my part. |
|
|
| |
|