Jump to content

Generating Unique Combinations From Fixed Data


Recommended Posts

#include <Excel.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>

Local $sku_array[0] ;13640
Local $name_array[0] ;13640
Local $sku_string
Local $name = "Name Here"; hardcoded, iterate through final list
Local $name_sku = "E001" ; hardcoded, iterate through final list

    For $size = 0 to 3 Step 1
        For $mg = 0 to 30 Step 1
            For $b = 0 to 1 Step 1
                For $menthol = 0 to 4 Step 1
                    For $vg = 0 to 10 Step 1
                        $sku_string = String($name_sku & $size & $mg & $b & $menthol & $vg)
                        _ArrayAdd($sku_array, $sku_string)
                        _ArrayAdd($name_array, $name)
                    Next
                Next
            Next
        Next
    Next
    ;_ArrayDisplay($name_sku_array, "Array Data:")
    Local $oExcel = _Excel_Open()
    Local $sWorkbook = @ScriptDir & "\FURLS_TRLM_Product_Listing_Eliquid.xls"
    Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, Default, Default, True)
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $sku_array, "B2:B13641")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $name_array, "J2:J13641")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $name_array, "A2:A13641")
    ;A2 or Column 1 - $name_string
    ;B2 or Column 2 - $sku_string
    ;J2 or Column 10 - $name_string

So I am trying to generate every unique combination using 1 value from each set and then place each generated value into an array and then write to an excel sheet.

Edit: Functional Code, F#CK THE FDA!

 

I have the following data sets:

Size: 10, 30, 50, 100

MG: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30  (shortened in the above code for time constraints while testing)

VG: 0,1,2,3,4,5,6,7,8,9,10

Boost: 0,1

Menthol: 0,1,2,3,4

Edited by newcoding
Link to comment
Share on other sites

  • Moderators

Another one moved to General Help and Support, Developer Forum clearly states "Do not post AutoIt topics here"

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...