 |
 |
|
|
|
|
 |
|
|
General
The ever-powerful List X module forum. Post your questions, new configuration ideas and reviews.
| You are not authorized to post a reply.
|
|
| Author |
Messages |
|
mikerennick
 Posts:55
 |
| 08/20/2008 12:49 PM |
Alert
|
Can I do this: {IIF,"'a'='a'",\{SET,myVar,5,Action\},""} It does not seem to work as it tries to render the SET statement as text. How can I conditionally assign a value to a variable? |
|
Mike Rennick |
|
|
svedire
 Posts:107
 |
| 08/20/2008 2:21 PM |
Alert
|
Hi,
You could this under Actions.
If 'a'='a' #Action:Assignment[myvar] = 5
The assignment statement should be indented.
Thanks, Sindura R2integrated |
|
|
|
|
mikerennick
 Posts:55
 |
| 08/21/2008 7:24 PM |
Alert
|
I should say that the purpose of the question was so that I could format a nested list (like the list of pages in DNN). I am trying to force a level indent if the parentID of the current record is the ID of the previous record. I am trying to end the indent and force an "out-dent" if the parentID of the current record is different from the parentID of the previous record, but not the ID of the previous record. This is how I would do this in ASP: ParentID = 0 'default prevID = RS("ID") prevParentID = 0 response.write("<ul>") do while not RS.eof currecParentid = RS("ParentID") if currecParentid = previd then 'the current record needs to be indented response.write("<ul>") elseif currecParentid <> prevParentID 'the current record needs an out-dent response.write("</ul>" end if response.write("<li>" & RS("CategoryName") & "</li>" prevParentID = RS("ParentID") prevID = RS("ID") RS.MoveNext loop response.write("</ul>") I have not tested the script above, so don't hold me to minor errors. I put it there so you could see the logic of what I am trying to do. The following is my translation into listx (which is not working): Header+++++++++++++++++++++++++++++ {SET,ParentID,0,Action} {SET,prevID,0,Action} 'note I want to set this to the ID of the first record but cannot {SET,prevParentID,0,Action} <ul> Footer+++++++++++++++++++++++++++++ </ul> List Item Detail+++++++++++++++++++++++++++++ {SET,currecParentid,[ParentID],Action} {IIF,"'[currecParentid,Action]'='[prevID,Action]' AND '[prevID,Action]'<>'0'","<ul>",""} {IIF,"'[currecParentid,Action]'<>'[prevParentID,Action]' AND('[currecParentid,Action]'<>'[prevID,Action]' AND '[prevID,Action]'<>'0')","</ul>",""} <li>[CategoryName]</li> {SET,prevParentID,[ParentID],Action} {SET,prevID,[ID],Action} |
|
Mike Rennick |
|
|
ewalker
 Posts:219

 |
| 08/22/2008 12:29 AM |
Alert
|
From a cursory glance, your code looks pretty good. Here is an example of how to implement a "counter" using the set statement and an action variable:
Place this in the header, footer, or an action.
{SET,val,{MATH,"[val,A]+1"},action} s:[val,a] |
|
Eric Walker - R2integrated |
|
|
mikerennick
 Posts:55
 |
| 08/22/2008 10:31 AM |
Alert
|
Can you explain this part of your code:
s:[val,a]
I do not recall seeing that anywhere, and I am not sure what it is doing. Also, please explain how I can place a counter in the header or footer, as I assumed these only executed ONCE at the beginning and end of the record loop.
Thanks for your help. |
|
Mike Rennick |
|
|
mikerennick
 Posts:55
 |
| 08/22/2008 11:11 AM |
Alert
|
I am completely baffled as to the order in which the listx code seems to execute.
For example, I initialize a variable in the header like this:
{SET,myVar,0,Action}
then, in the List Item Detail I try this:
my var = [myVar,Action] {SET,myVar,[ID],Action}
Let's say there are three records returned by the main query with IDs of:
75, 76, 77
Here is what I would expect to see as output on the page:
my var = 0 my var = 75 my var = 76 my var = 77
Here is what I am seeing:
my var = 75 my var = 76 my var = 77
what happened to the 0 that I initialized in the header? It would seem that it was overwritten by the SET statement BEFORE it was written, even though I am writing the value of the Action variable BEFORE the SET statement. Thus it would seem that there is no adherence to the order of statements within the List Item Detail.
Can someone please explain this.
|
|
Mike Rennick |
|
|
robert_chumley
 Posts:595
 |
| 08/25/2008 8:37 AM |
Alert
|
Hello Mike, What you are seeing here is correct. ListX unfortunantly does not have a great ordering when executing SET tags. This is a known issue using the system. What you are basically seeing is that the SET is occuring before it is ever being used in the action. You should see this behavior if you add the
my var = [myVar,Action]
In your header. Thanks, |
|
Robert Chumley r2integrated (formally bi4ce) |
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.6
|
|
| Latest Post
|
 |
|
At R2integrated (formerly Bi4ce), we take support seriously. That's why we support our customers and DNN community with daily monitoring from our experienced engineering team. We ask that the first step taken is to read the relevant documentation and support forums prior to submitting any questions that may already be available or have been answered. We ask that you review the documentation that we provide for our products before posting a question.
The Forums are for our customers to chat, exchange ideas and strategies, and submit feedback. Please be sure to perform keyword searches for previous related forum responses.
To be helpful when submitting a new item, please include the following:
- DNN Version
- Module Version
- Admin Log Viewer Information
- Environment detail: Operating system, .NET framework version, database and version, IIS version, Browser version (if appropriate)
We always try to respond quickly and monitor the forums daily during business hours (EST). Occasionally, requests for a specific project requirement may not apply for the free support offered. For project specific support please submit via our Information Request form.
Thank you for using our Forums.
Click here to register for the Forums
|
|
|
|
| © 2008 by R2integrated (formerly Bi4ce) | DNN® is a registered trademark of DotNetNuke Corporation
|
 |
|
|
|
 |
 |