Print Page | Close Window

Query_SplitToMultiRowsReMergeSorted

Printed From: Roger's Access Library
Category: Other Download Libraries
Forum Name: Tejpal, A.D.
Forum Description: A.D. Tejpal's Library
URL: www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=459
Printed Date: 23 Apr 2024 at 10:32am
Software Version: Web Wiz Forums 12.03 - http://www.webwizforums.com


Topic: Query_SplitToMultiRowsReMergeSorted
Posted By: A.D. Tejpal
Subject: Query_SplitToMultiRowsReMergeSorted
Date Posted: 17 Jun 2009 at 6:03pm

Query_SplitToMultiRowsReMergeSorted
Explanatory Notes

    This sample db demonstrates splitting of comma (,) or star (*) separated string elements into multiple rows followed by re-merging of these elements duly sorted, back into strings. It is a virtually codeless solution, but for use of two wrapper functions related to built in Split() function.

    For splitting the strings into multiple rows, a single field table (T_Ref) populated with numbers 0 to 10 is used in Cartesian join with the table holding source data. The sorted output is appended to table T_Jobs_Split, which in turn is used to generate the crosstab query followed by final select query, re-merging the sorted elements back into strings.

    Note:
    (a) If the maximum number of elements in one string is likely to exceed 10, additional numbers can be added to table T_Ref. At the same time, pivot clause of crosstab query  and calculated field of final select query (based upon crosstab query) will need o be expanded to accommodate additional columns.
    (b) Use of number reference table (as compared to master job table) in Cartesian join with source table for generating multiple rows has the advantage that it eliminates the risk of inconsistent results arising out of partial match using Like operator. Moreover, it does away with the need of preparing such a table and keeping it up-to-date, apart from ensuring that there is no inadvertent discrepancy in its contents.

Version: Access 2000 file format.

Reference: DAO 3.6

Download >>:  http://www.rogersaccesslibrary.com/forum/uploads/37/Query_SplitToMultiRowsReMergeSorted.zip - uploads/37/Query_SplitToMultiRowsReMergeSorted.zip



-------------
--

Email: mailto:adtejpal@gmail.com - adtejpal@gmail.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net