Query format question

Results 1 to 2 of 2

Thread: Query format question

  1. #1
    Join Date
    Dec 1969

    Default Query format question

    Hi,<BR><BR>I have a table like this...<BR><BR>ID(autonumber)/ReferID(number)/LanguageID(number)/Text(string)<BR>1/2000/1/Example textstring <BR>2/2000/3/Voorbeeld tekst<BR>3/2001/1/Goodmorning<BR>4/2002/2/Bonjour<BR>5/2002/3/Goedemorgen<BR><BR>Now I want to have to have an output like this:<BR>2000/Example test/[empty]/Voorbeeld tekst <BR>2001/Goodmorning/Bonjour/Goedemorgen<BR><BR>Any suggestions?<BR><BR>Thanks!

  2. #2
    Eddie Campbell Guest

    Default RE: Query format question

    I assume that there is an error in your post and that the ReferID for Goodmorning should be 2002. If so try this<BR><BR>First order your recordset by ReferID By LanguageID (to get all the language versions together sorted by language).<BR><BR>Then do this (NOTE: I have just typed this in roughly, so it may need work to get it right)<BR><BR>MyString = ""<BR>MyLang = 1<BR>LastId = MyRs("ReferID")<BR>Do while Not(MyRs.EOF)<BR> If LastId &#060;&#062; MyRs("ReferID") Then<BR>&#039;<BR>&#039;&#039;&#039; We have moved to a new ReferID<BR>&#039; <BR> For I = MyLang To 3<BR> MyString = MyString & "/[empty]"<BR> Next<BR> MyLang = 1<BR> LastId = MyRs("ReferID")<BR> Response.Write MyString<BR> MyString = ""<BR> End If<BR> If Len(MyString) = 0 then<BR> MyString = MyRs("ReferID") & "/" <BR> End If<BR>&#039;<BR>&#039;&#039;&#039; If we have data then add it to the string and move on<BR>&#039;&#039;&#039; otherwise put the string [empty] in.<BR>&#039;<BR> If MyLang = MyRs("LanguageID") Then &#039; check that this is the correct language for this column<BR> MyString = MyString & MyRs("ReferID")<BR> MyRs.MoveNext<BR> Else<BR> MyString = MyString & "/[empty]"<BR> End If<BR> MyLang = MyLang + 1<BR> If MyLang &#062; 3 then MyLang = 1<BR>Loop<BR>&#039;<BR>&#039;&#039;&#039; If there is an unprinted record, print it now<BR>&#039;<BR>If Len(MyString) &#062; 0 then<BR> Response.Write MyString<BR> For I = MyLang To 3<BR> MyString = MyString & "/[empty]"<BR> Next<BR>End If<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts