gcue Posted July 5, 2019 Share Posted July 5, 2019 hello world i have been looking through different examples of permutations but have not been able to find one which allows a required value hope example makes sense $master_value = "Z" Global $value_list[4] = ["A", "B", "C", "D"] so the possible combinations would be something like this (all would include the "master value") Quote Z,A A,Z Z,B B,Z Z,C C,Z Z,D D,Z Z,A,B Z,B,A A,Z,B B,Z,A B,A,Z A,B,Z Z,A,B,C Z,B,C,A Z,C,B,A ...... thank you in advance! Link to comment Share on other sites More sharing options...
Developers Jos Posted July 5, 2019 Developers Share Posted July 5, 2019 So what exactly is the question? I hope you're not asking for an script or something. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
gcue Posted July 5, 2019 Author Share Posted July 5, 2019 I am asking on a method on how to accomplish what i described. Users are picking a business role and I'd like to be able to go through a list of other business role values (defined by the user) to store all possible combinations to an array which will later be used as possible filters in a check list. Hope that makes sense Link to comment Share on other sites More sharing options...
Nine Posted July 5, 2019 Share Posted July 5, 2019 I would use recursion to get all the possible combinations and then save only the ones having the master value inside... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
jchd Posted July 5, 2019 Share Posted July 5, 2019 Spoon-feeding will probably shorten this thread. Local $master_value = "Z" Local $value_list = ["A", "B", "C", "D"] Local $a, $aa, $aRes[0] For $i = 1 To UBound($value_list) $a = _ArrayCombinations($value_list, $i) _ArrayDelete($a, 0) For $j = 0 To UBound($a) - 1 $aa = _ArrayPermute(StringSplit($a[$j] & $master_value, "", 3), ',') _ArrayDelete($aa, 0) _ArrayAdd($aRes, $aa) Next Next $ad($aRes) pixelsearch 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
iamtheky Posted July 5, 2019 Share Posted July 5, 2019 (edited) <*snip - all wrong and would only serve to confuse, plus maybe not supposed to be helping yet> Edited July 6, 2019 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Nine Posted July 5, 2019 Share Posted July 5, 2019 (edited) I remember when I started at this site, mods were blasting me about providing code without at least a first effort from the OP. Now I understand what is the concept of variable geometry... Edited July 5, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
iamtheky Posted July 5, 2019 Share Posted July 5, 2019 tbf, gcue has like 2100 posts worth of effort. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
jchd Posted July 5, 2019 Share Posted July 5, 2019 @Nine, Some OPs have a record of making threads long lasting... @iamtheky, the first code misses some combinations, e.g. BZ, CZ, ABDZ, ... This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
jchd Posted July 5, 2019 Share Posted July 5, 2019 @iamtheky the second code has the same issue as your first. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
iamtheky Posted July 5, 2019 Share Posted July 5, 2019 yup, they both do. I had a feeling getting rid of the second loop wasnt going to be that easy. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Nine Posted July 5, 2019 Share Posted July 5, 2019 1 minute ago, jchd said: Some OPs have a record of making threads long lasting... So what is the problem with that ? 3 minutes ago, iamtheky said: tbf, gcue has like 2100 posts worth of effort. Effort ? With 9+, asking for code repeatedly is not what I would call it. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
jchd Posted July 5, 2019 Share Posted July 5, 2019 @Jos, sorry for that! iamtheky 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
iamtheky Posted July 5, 2019 Share Posted July 5, 2019 really by the +'s ? I've been judging people by their warning points, and by height. and also i was following the badged guy, and my answers were wrong anyway ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2019 Developers Share Posted July 6, 2019 (edited) 10 hours ago, jchd said: Spoon-feeding will probably shorten this thread. Local $master_value = "Z" Local $value_list = ["A", "B", "C", "D"] Local $a, $aa, $aRes[0] For $i = 1 To UBound($value_list) $a = _ArrayCombinations($value_list, $i) _ArrayDelete($a, 0) For $j = 0 To UBound($a) - 1 $aa = _ArrayPermute(StringSplit($a[$j] & $master_value, "", 3), ',') _ArrayDelete($aa, 0) _ArrayAdd($aRes, $aa) Next Next $ad($aRes) Not sure whether this will be considered spoon-feeding as the food isn't ready yet and still contains "uncooked bits". Jos Edited July 6, 2019 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jchd Posted July 6, 2019 Share Posted July 6, 2019 Yeah, some chunks might need some chewing 🐅 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
mikell Posted July 6, 2019 Share Posted July 6, 2019 (edited) 15 hours ago, iamtheky said: really by the +'s ? I've been judging people by their warning points, and by height. Bah. Just place some jokes and you will get a lot of +'s . Not significant BTW you should like this alternative, based on simple String* funcs only #Include <Array.au3> Global $master = "Z", $text[5] = ["A", "B", "C", "D", $master], $s = "" _LetsGo("") $a = StringSplit(StringTrimRight($s, 1), "|", 2) _ArrayDisplay($a) Func _LetsGo($string) For $i = 0 to UBound($text)-1 If not StringInStr($string, $text[$i]) Then $tmp = $string & "," & $text[$i] If StringInStr($tmp , $master) and StringLen($tmp)>2 Then $s &= StringTrimLeft($tmp, 1) & "|" EndIf _LetsGo($tmp) EndIf Next EndFunc Edited July 6, 2019 by mikell iamtheky, pixelsearch and Earthshine 3 Link to comment Share on other sites More sharing options...
jchd Posted July 6, 2019 Share Posted July 6, 2019 Needs more chewing This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
mikell Posted July 6, 2019 Share Posted July 6, 2019 It strictly fits the OPs requirements from post #1 Link to comment Share on other sites More sharing options...
gcue Posted July 7, 2019 Author Share Posted July 7, 2019 Works great thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now