Data rows - unique

I think i know the answer but wanted to check. Using the data rows - unique module, is there anyway to apply it to the parent record only and ensure unique children only in that one parent?

example

t>
	<data>
		<row>
			<Date>07/01/2022</Date>
			<Reference/>
			<Description>10-IN-Invoices - Posted 07-07/01/2022</Description>
			<Number_of_Distributions>79</Number_of_Distributions>
			<ClientID>000286</ClientID>
			<FileType>IN</FileType>
			<Clients>
				<Client>
					<ClientID>000286</ClientID>
				</Client>
				<Client>
					<ClientID>000286</ClientID>
				</Client>
				<Client>
					<ClientID>000286</ClientID>
				</Client>
				<Client>
					<ClientID>000286</ClientID>
				</Client>
				<Client>
					<ClientID>000286</ClientID>
				</Client>
				<Client>
					<ClientID>000231</ClientID>
				</Client>
				<Client>
					<ClientID>000231</ClientID>
				</Client>
				<Client>
					<ClientID>000231</ClientID>
				</Client>
				<Client>
					<ClientID>000231</ClientID>
				</Client>
				<Client>
					<ClientID>000212</ClientID>
				</Client>
				<Client>
					<ClientID>000212</ClientID>
				</Client>
				<Client>
					<ClientID>000212</ClientID>
				</Client>
				<Client>
					<ClientID>000212</ClientID>
				</Client>
			</Clients>
		</row>
	</data>
	<data>
		<row>
			<Date>07/01/2022</Date>
			<Reference/>
			<Description>10-CR-Cash Receipts - Post-07/01/2022</Description>
			<Number_of_Distributions>2</Number_of_Distributions>
			<ClientID/>
			<FileType>CR</FileType>
			<GLrow>
				<GL_Account>10100</GL_Account>
				<Location>10</Location>
				<ProjectID/>
				<ClientID/>
				<ClassID/>
				<EmployeeID/>
				<Amount>461001.46</Amount>
				<tranType>1</tranType>
			</GLrow>
			<GLrow>
				<GL_Account>11001</GL_Account>
				<Location>10</Location>
				<ProjectID/>
				<ClientID/>
				<ClassID/>
				<EmployeeID/>
				<Amount>461001.46</Amount>
				<tranType>-1</tranType>
			</GLrow>
			<Clients>
				<Client>
					<ClientID>000212</ClientID>
				</Client>
				<Client>
					<ClientID>000212</ClientID>
				</Client>
			</Clients>
		</row>
	</data>
</root>]

within each “row” there is a “clients” node. there are repeating clientIDs that needs to be unique but only unique to that “row”. in the sample data 000212 exists in both rows.

currently if i run the unique module, that second row’s 000212 values are removed since it already exists in the first “row”. Is there a way to use the unique value that way? if not I assume i would have to create an array or hash table when building out this dataset and unique values that way.

One idea to try is to use a Loop module that iterates through each row and within the Loop place a subassembly, where the subassembly is receiving each row as XML input and uses the Data Rows - Unique module.

The subassembly would look like this:

The idea is to get the scope for the unique module down to an individual row by using an outer Loop as the scoping mechanism.

Not sure if the Loop will actually pass in the row node as I outlined. Let me know if not, I’m wanting to know if this approach works or not…

my first thought was to add a unique module to the data rows loop module but it isnt allowed. so i ended up just building a hashset while i was building the xml. then just looping through the set and adding the values to the xml. ended up working out fine so far (still working on it).

out of curiousity, what validation does the system use to say if a subassembly can or cannot be used in a loop module?

That’s right, since the Unique module is not built to be within a Loop, wrapping it in a subassembly is the workaround.

There is a setting in the Module IDE that determines if a module can be Looped. It is up to the module’s developer to build it in a manner where it can be Looped and to set that setting.

Generally, modules that have a “Data Stream” selection cannot be Looped, since it is the Loop that controls which data stream is processed.

Of course, the most flexible solution that I use most often is to just write Java JSP logic with the XML parser. The processing modules are intended to handle the most common scenarios.