문제

I have taken over some work on an existing system that uses NVelocity templates. It iterates though some rows of data and then loops though the fields creating an html table of the data. I want to change this so that some of the table cells contains data from a different field.

here is how it works:

#if($data.Count > 0)
    #set ($end = $data.Count - 1)
    #foreach($count in [0 .. $end])
        <tr class="$!class $!alerts $!status">
        #set($colcount = 0)
        #foreach($field in $fields)
            <td class="$!colclass">
                $data.GetData($count, $field)
            </td>
        #end
        </tr>
    #end
#end

What I want it to do something like this :

#if($data.Count > 0)
    #set ($end = $data.Count - 1)
    #foreach($count in [0 .. $end])
        <tr class="$!class $!alerts $!status">
        #set($colcount = 0)
        #foreach($field in $fields)
            #if($field.Name=="JourneyAlias")
                $data.GetData($count, $field) - $data.GetData($count, 'JourneyId')
            #else
                <td class="$!colclass">
                    $data.GetData($count, $field)
                </td>
            #end
        #end
        </tr>
    #end
#end

In short I want to know how to access the field JourneyId from the data

도움이 되었습니까?

해결책

Sorted the issue I needed this syntax:

#set($journeyid = $data.DataItem($count).JourneyID)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top