November 29, 200421 yr Hi I'm using FileMaker Unlimited 5 and am having trouble with a CDML If statement. I've been using CDML for almost a year now and have encountered something similar before. I think I was told it was a bug in the web companion but here goes... I have a CDML if statement on my format page which tests a value of a field. Here's what I've got... [FMP-Record] [FMP-If: Field: ODD|EVEN .eq. ODD] <tr align="left" valign="top" class="row1"> <td>[FMP-Field: ODD|EVEN]</td> </tr> [FMP-Else] <tr align="left" valign="top" class="row2"> <td>[FMP-Field: ODD|EVEN]</td> </tr> [/FMP-If] [/FMP-Record] There's a field in my database called EVEN|ODD which is an unstored calculation. It detects the current record number and works out whether it is an even or odd record, then pastes the text 'ODD' or 'EVEN' into that field as appropriate. The reason for this is that I want to add alternate colour coding for record rows on my results page so if it is odd you see above it uses the CSS class row1, and if it is even it should use the CSS class row2. Only it's not working like that. Looking at the FileMaker Unlimited machine the results look fine. The value of ODD|EVEN is calculated correctly and the value alternates with each record. However on the results page I get an odd, two evens, then two odds, then 3 evens in a seemingly random spread. Meaning my alternating row CSS code gets changed and the thing looks bad. Even though the value of ODD|EVEN is calculated correctly on the FileMaker Unlimited Does anyone know why this happens? I found a way round this in the past by instead of doing a [FMP-If] for each record to test the value, a calculation field displays whichever version of <tr... is appropriate. I'd prefer not to have to 'get round' something like this and wondered if it was something I've done wrong above. To see this weird effect take a look at: http://192.168.1.5:591/FMPro?-DB=AMDPROS...kip=0&-Find Even though on FMU the values of ODD|EVEN do not correspond to what the record shows on the results page. Anything obvious that people can see that I'm missing? Thanks Ben
November 29, 200421 yr Author I did think at first that it might be something to do with my sort order but the records are correctly sorted by the field SHOP NAME both on the results page and on the copy of FileMaker Unlimited. Any ideas? This is driving me insane. Ben
November 29, 200421 yr Ben, The Calculation field may be calculating before the sort. Did you test by having the field, and RecordNumber, display as a list in a browser window? We usually use Javascript to alternate row colours. For example: <script>[FMP-Record] if ([FMP-CurrentRecordNumber] % 2 != 0) { document.write('<tr align="left" valign="top" class="row1">'); document.write('<td>[FMP-Field: ODD|EVEN]</td>'); document.write('</tr>'); } else { document.write('<tr align="left" valign="top" class="row2">'); document.write('<td>[FMP-Field: ODD|EVEN]</td>'); document.write('</tr>'); }; [/FMP-Record] </script> All the best. Garry
November 30, 200421 yr Author If I generate a CDML page as you say above, using a list of ODD|EVEN and FMP-CurrentRecordNumber then the records are sorted correctly with record numbers increasing from 1 to whatever. However the value of ODD|EVEN is incorrect. It might not be the ODD|EVEN calculation that's causing the fault. It might be that FileMakers Status(CurrentRecordNumber) is performed before the sort as you say. Even though I hate JavaScript I guess that's the only way for now. Thanks for the suggestion. Ben
Create an account or sign in to comment