Jump to content

Array Sorting Based on Another Array


jcvincent

Recommended Posts

Good day all,

 

I have two arrays; 1. An array that holds the correct sorting of the jobs to be executed, 2. An array that holds the current trigger files that were created to run specific jobs.

 

In the 2nd array, the sorting is alphabetical based on how GLOB() read the directory where the trigger files are saved. I want to correct the sorting of array number 2 based on the sorting in Array 1. Array number 1's values are based on a text file I created with the proper sorting (based on the priority list in a batch file). Below is what the text file looks like:

 

ActSMvar.txt

ActMMvar.txt

StatSMvar.txt

StatMMvar.txt

EA_Asia_Automation_Ready.txt

EA_Corp_Automation_Ready.txt

Agg_QRF_Ready.txt

HYP_Stats_SCM_Ready.txt

HYP_Stats_Care_Ready.txt

HP_Subs_Ready.txt

EA_Currency_Rates_Ready.txt

CorpRpts_DIM_Export_Ready.txt

Global_Headcount_Ready.txt

Asia_Actuals_HP_Ready.txt

 

As you can see, array number 1 will look like this:

 

Array ( [ 0 ] => ActSMvar.txt [1] => ActMMvar.txt [2] => StatSMvar.txt [3] => StatMMvar.txt [4] => EA_Asia_Automation_Ready.txt [5] => EA_Corp_Automation_Ready.txt [6] => Agg_QRF_Ready.txt [7] => HYP_Stats_SCM_Ready.txt [8] => HYP_Stats_Care_Ready.txt [9] => HP_Subs_Ready.txt [10] => EA_Currency_Rates_Ready.txt [11] => CorpRpts_DIM_Export_Ready.txt [12] => Global_Headcount_Ready.txt [13] => Asia_Actuals_HP_Ready.txt )

 

 

Currently, array number 2 looks like this:

 

Array ( [ 0 ] => ActMMvar.txt [1] => ActSMvar.txt [2] => Agg_QRF_Ready.txt [3] => EA_Asia_Automation_Ready.txt [4] => EA_Corp_Automation_Ready.txt [5] => StatMMvar.txt [6] => StatSMvar.txt )

 

Now, I want to know how will I force the sorting of array number 1 to array number 2?

 

Thanks in advance.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.