WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: 1bosborn on June 25, 2021, 12:56:24 PM

Title: Insert data from one array into another
Post by: 1bosborn on June 25, 2021, 12:56:24 PM
I am working on a project where I want to see if data from one two dimensional array exists in a second array, and if so insert the entire row into a third array. It's been rolling around in my head as possibly some custom function using ArrayInsert on the target and a For/Next loop to get the values from the source array and assign the values to the inserted row in the target. I just thought I would ask if there is a built-in function I am missing before I tried to build something custom. Thanks as always for your wisdom.
Title: Re: Insert data from one array into another
Post by: td on June 25, 2021, 01:18:51 PM
There are several ways to approach your task but there is no one function that does it for you. So you will have to create something. Here is a link to a list of WIL array functions:

https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/ArrayHandling.htm

Staring at the list may help you imagine a clever solution.

One suggestion is to sort your rank 2 (two-dimensions) array(s). That will make searching quicker.

Title: Re: Insert data from one array into another
Post by: JTaylor on June 25, 2021, 02:41:17 PM
You might also consider the Omnibus Extender and its SQLite capabilities.  Depending on what you are doing it you might find it an attractive alternative.

Jim
Title: Re: Insert data from one array into another
Post by: stanl on June 26, 2021, 02:40:42 AM
Quote from: JTaylor on June 25, 2021, 02:41:17 PM
You might also consider the Omnibus Extender and its SQLite capabilities.  Depending on what you are doing it you might find it an attractive alternative.

Jim


I agree with Jim's suggestion, especially if your arrays could be considered row,column assignments.


[EDIT] of course, this could turn out to be another 'homework'.....