---
title: "Loopa poster"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/138626-loopa-poster"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "MarreMan"
published: "2005-12-02T06:21:00.000Z"
updated: "2005-12-02T07:07:45.000Z"
replies: 7
views: 350
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/138626-loopa-poster"
---

# Loopa poster

## #1 — MarreMan, 2005-12-02T06:21Z

Jag har en tabell där en del kolumner saknar värde och dessa vill jag utesluta i listningen av posterna. Hur gör jag det på ett bra sätt?   :q 

Jag provade en modell med If-satser men det blir ganska många. Någon som har en bättre metod?

Permalänk: https://www.webforum.nu/p/138626

## #2 — M.Cheraghi, 2005-12-02T06:23Z

```
Do until RecSet.eof
   IF RecSet("Kolumn") <> "" THEN
     response.write RecSet("Kolumn")
   end IF
RecSet.movenext
loop
```

Permalänk: https://www.webforum.nu/p/1720808

## #3 — MarreMan, 2005-12-02T06:28Z

OK, men om jag har en tabell liknande denna då?

```
<table>

<tr>
<td>Kol 1</td>
<td>Kol 2</td>
<td>Kol 3</td>
<td>Kol 4</td>
<td>Kol 5</td>
</tr>

<%
	Do While Not recset.EOF
%>

<tr>
<td><%=recset("Kol1")%></td>
<td><%=recset("Kol2")%></td>
<td><%=recset("Kol3")%></td>
<td><%=recset("Kol4")%></td>
<td><%=recset("Kol5")%></td>
</tr>

<%
	recset.MoveNext
	Loop
	recset.Close
	Connect.Close
%>

</table>
```

Och vill utesluta även kolumnrubrikerna?

Permalänk: https://www.webforum.nu/p/1720810

## #4 — M.Cheraghi, 2005-12-02T06:34Z

altså, du vill att om: kol1-5, någon av dom, om någon är tom så ska det inte visas? eller är det om kol1 är tom som det inte ska visas?

Permalänk: https://www.webforum.nu/p/1720811

## #5 — MarreMan, 2005-12-02T06:42Z

Japp, om ex kolumn 2 och 5 är tomma så skall inte dessa visas, varken rubrik eller kolumn i listning.

Permalänk: https://www.webforum.nu/p/1720816

## #6 — M.Cheraghi, 2005-12-02T06:47Z

```
<table>

<tr>
<td>Kol 1</td>
<td>Kol 2</td>
<td>Kol 3</td>
<td>Kol 4</td>
<td>Kol 5</td>
</tr>

<%
	Do until RecSet.eof
            IF RecSet("kol1") <> "" AND RecSet("kol2") <> "" AND RecSet("kol3") AND RecSet("kol4") <> "" AND RecSet("kol5") <> "" THEN
%>

<tr>
<td><%=recset("Kol1")%></td>
<td><%=recset("Kol2")%></td>
<td><%=recset("Kol3")%></td>
<td><%=recset("Kol4")%></td>
<td><%=recset("Kol5")%></td>
</tr>

<%
        END IF
	recset.MoveNext
	Loop
	recset.Close
	Connect.Close
	SET RecSet = nothing
	SET Connect = nothing
%>

</table>
```

Något sådant du söker? Går säkert att få det att bli effiktivare.

Permalänk: https://www.webforum.nu/p/1720818

## #7 — MarreMan, 2005-12-02T07:01Z

Med den kodsnutten listas ingenting.

Permalänk: https://www.webforum.nu/p/1720825

## #8 — MarreMan, 2005-12-02T07:07Z

Med denn kod fungerar det men det blir rätt många If:s

```
<table>

<tr>
< If Not recset("kol1") "" Then %>
<td>Kol 1</td>
<% End If 
If Not recset("kol2") "" Then %>
<td>Kol 2</td>
<% End If 
If Not recset("kol3") "" Then %>
<td>Kol 3</td>
<% End If 
If Not recset("kol4") "" Then %>
<td>Kol 4</td>
<% End If 
If Not recset("kol5") "" Then %>
<td>Kol 5</td>
<% End If %>
</tr>

<%
	Do While Not recset.EOF
%>

<tr>
< If Not recset("kol1") "" Then %>
<td><%=recset("Kol1")%></td>
<% End If 
If Not recset("kol2") "" Then %>
<td><%=recset("Kol2")%></td>
<% End If 
If Not recset("kol3") "" Then %>
<td><%=recset("Kol3")%></td>
<% End If 
If Not recset("kol4") "" Then %>
<td><%=recset("Kol4")%></td>
<% End If 
If Not recset("kol5") "" Then %>
<td><%=recset("Kol5")%></td>
<% End If %>
</tr>

<%
	recset.MoveNext
	Loop
	recset.Close
	Connect.Close
%>

</table>
```

Permalänk: https://www.webforum.nu/p/1720827

---

Tråden på webben: https://www.webforum.nu/amne/asp/138626-loopa-poster
