newcoding

Generating Unique Combinations From Fixed Data

2 posts in this topic

#1 ·  Posted (edited)

#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

Share this post


Link to post
Share on other sites



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


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
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

  • Similar Content

    • tcox8
      By tcox8
      Hello,
      Currently I am running a script that calls a powershell script. To read the results of that I am reading StdOut. I am parsing things accordingly but unfortunately it doesn't parse correctly all the time and I end up missing parts of the string or other problems. My question then is, what is the best results for reading what is returned when running a powershell script or something similar?
    • Valnurat
      By Valnurat
      I hope my title is good enough.
      I'm using the ADO UDF and I have question regarding editing SQL records with this UDF.
      The owner of the UDF suggested an idea, but maybe there is another trix.
    • Valnurat
      By Valnurat
      I have a SQL db. I would like to view the content in a control. Like a table. The control should have the option to show every 2nd line in another color. When you pick a "cell" it should pick the whole row. When you dobbelt click on the row another windows should popup with the content from the row.
      What view control can do that?
    • Valnurat
      By Valnurat
      How do I access a sql database for inserting and reading?
    • Valnurat
      By Valnurat
      I'm trying to get some info from dell.com page. I use a servicetag to find the computer. From the computerinfo I would like to get the "Shipping Date", but the date is on the next "cell".
      I have done this and I don't know if this is correct aproach, but I do get some info out.
      I just don't know how to "jump" to the next cell.
       
      #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("http://www.dell.com/support/home/dk/da/dkbsdt1/product-support/servicetag/gnn5f12/configuration") Local $oTds = _IETagNameGetCollection($oIE, "td") Local $sTxt = "" For $oTd In $oTds $sTxt &= $oTd.innertext & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Form Input Type", " Types :" & @CRLF & $sTxt) _IEQuit($oIE) I have seen something like this in VBscript
      Cell.NextSibling.NextSibling.innertext Is there someone who could help me.