Developer forum

Forum » Templates » Data List module not showing right Detail URL

Data List module not showing right Detail URL


Reply
Go to http://www.cphvision.dk/Exhibitors/Exhibitors.aspx?Purge=True&Fair=480

This site is working fine.

Then go to http://www.cphvision.dk/Exhibitors/Brands.aspx?Purge=True&Fair=480

The list here is fine, but in the URL on the list-items something is missing. I think AccessUserID is being left out, but I can't figure out why.

Please help :-)

Replies

 
Reply
Hi there,

Did you select thatAccessUserId or other columns in the selected field list for the details page?

Cheers,

Imar
 
Reply
 It doesn't really make a difference what fields I select in the module settings in the paragraph. If I try using another DataList from the Data List Module, it works perfectly fine. Suggestions?
 
Reply

Is your Data List set up correctly? What happens when you use the SQL of the list that does work?

Imar
 

 
Reply
 The other SQL works fine it seems. Basically I copied the other one, and changed it from the standard DataList-mode to SQL and wrote my own SQL query that fetches what I need.
 
Reply
 Can I get someone from Dynamicweb to respond to this?
 
Reply

Hi,
DataList module uses table’s primary key. If your SQL simple and looks like

“SELECT [AccessUserID], [AccessUserName] FROM [AccessUser] WHERE AccessUserID IN (274, 275)”,

it’s OK, you will receive 2 unique rows, the module will be able to use AccessUserID as primary key and generate valid details link. 

Try to use another SQL (I’ve created this example based on your “Brandlist” data list):

“SELECT [AccessUserID], [AccessUserName] FROM [AccessUser] WHERE AccessUserID IN (274, 275)
UNION ALL
SELECT [AccessUserID], [AccessUserName] FROM [AccessUser] WHERE AccessUserID IN (274, 275)” 

In this case we will receive 4 rows and AccessUserID will be duplicated twice. The module can’t use the field as primary key and generate valid details link. The module can’t detect what field is primary.

Solution. If you need valid details link, always track what a Datalist SQL statement returns.

 
Reply
If I understand you correctly - your answer is that it is not possible for me to get the right DetailURL with an advanced/large SQL query like mine?

We need to get the right URL somehow, so have you got other suggestions?
 
Reply
You could try UNION instead of UNION ALL, as SQL Server removes duplicates in that case.

Not sure if it helps, but it's worth a try...

Regards,

Imar
 
Reply
Hey everyone.

 

I fixed it by printing out the AccessUsedId field as a column along with the two other columns in my output. Then I made a javascript that took the first value of each row (The AccessUserId) and generated a link for the two other rows based on this Id (Which was the only thing I was missing in the link).

This solution is not really elegant, since it uses javascript, but it works!

And ofcourse I used CSS to hide the AccessUserId that i printed out as a column, since it's not needed for anything except generating a valid DetailUrl.

See it in action here: http://www.cphvision.dk/Exhibitors/Brands.aspx?Purge=True

 
Reply
I just have answered why the details link is incorrect.
As solution you can create 10 data lists with simple SQL queries, than add them to the page.
 
Reply
 Hey!

Yeah, well that would work in regards to the DetailURL. Unfortunately I can't really see any good way of sorting the list, if it is generated by 10 separate quieries.

Anyway, the client is happy with the javascript fix, so we'll leave at at that for now.

 

You must be logged in to post in the forum