locked
Sorting Data RRS feed

  • Question

  • Year Prime Time Star  Location Price
    2017 1553 15:54 Arcturus  Rite-Aid $20.72
    2017 1553 15:49 Arcturus Rite-Aid $0.00
    2017 1511 20:53 Vega  Rite-Aid $6.88
    2017 1511 17:20 Arcturus Rite-Aid $9.08
    2017 1511 17:22 Arcturus Rite-Aid $13.93
    2017 1511 17:25 Arcturus Rite-Aid $7.42
    2017 1489 19:47 Antares  Rite-Aid $9.08
    2017 1487 21:38 Altair  Rite-Aid $1.16
    2017 1471 20:19 Vega  Rite-Aid $1.16
    2017 1471 10:21 Pollux  Rite-Aid $0.00
    2017 1447 21:01 Vega  Rite-Aid $1.16
    2017 1201 12:35 Procyon  Rite-Aid $2.10
    2017 1201 12:38 Procyon  Rite-Aid $0.00
    2017 1187 11:43 Sirius  Rite-Aid $26.49
    2017 1163 15:12 Regulus  Rite-Aid $0.00
    2017 1163 13:40 Pollux  Rite-Aid $1.99
    2017 1123 17:15 Spica  Rite-Aid $0.00
    2017 1093 21:13 Antares  Rite-Aid $10.00
    2017 1091 20:57 Arcturus Rite-Aid $2.29
    2017 1063 15:28 Regulus  Rite-Aid $1.99
    2017 1033 18:05 Regulus  Rite-Aid $0.00
    2017 967 13:15 Betelgeuse Rite-Aid $0.00
    2017 883 13:53 Betelgeuse Rite-Aid $3.58
    2017 881 14:17 Sirius  Rite-Aid $9.20
    2017 877 21:00 Spica  Rite-Aid $0.00
    2017 827 15:54 Procyon  Rite-Aid $0.00
    2017 743 20:06 Regulus  Rite-Aid $0.00
    2017 673 12:48 Aldebaren Rite-Aid $3.00
    2017 643 9:37 Fomalhaut Rite-Aid $7.00
    2017 439 16:12 Aldebaren Rite-Aid $5.30
    2017 359 20:32 Procyon  Rite-Aid $4.64
    2017 307 9:50 Altair  Rite-Aid $2.32
    2017 317 8:30 Vega  Rite-Aid $31.00
    2017 383 20:56 Pollux  Rite-Aid $1.16
    2017 347 20:07 Sirius  Rite-Aid $21.19
    2017 317 20:27 Sirius  Rite-Aid $1.16
    2017 313 21:36 Pollux  Rite-Aid $2.32
    2017 421 18:34 Betelgeuse Rite-Aid $2.38
    2017 197 13:56 Fomalhaut Rite-Aid $7.94
    2017 239 21:30 Sirius  Rite-Aid $40.00
    2017 199 10:41 Altair  Rite-Aid $1.35
    2017 193 14:45 Fomalhaut Rite-Aid $2.32
    2017 223 20:45 Betelgeuse Rite-Aid $11.65
    2017 149 9:27 Vega  Rite-Aid $0.00
    2017 269 12:13 Fomalhaut Rite-Aid $7.61
    2017 199 13:00 Fomalhaut Rite-Aid -$1.10
    2017 239 13:04 Fomalhaut Rite-Aid $20.00
    2017 31 18:00 Fomalhaut Rite-Aid $0.00
    2017 101 13:03 Deneb  Rite-Aid $14.47

    I would like to sort the above sample data by year, prime, price, location, time then star. The star order is

    Sirius, Procyon, Pollux, Regulus, Spica, Arcturus, Antares, Vega, Altair, Deneb, Fomalhaut, Aldebaren, Rigel, Capella, Betelgeuse. I plan on expanding the data to different years and locations. Also, I need a total for price. I would

    like to do this without Excel by taking advantage of the speed and versatility of Powershell.

    The actual data is easier to manage in .dat or .txt format so that is why I chose Powershell over Excel plus

    I want to add on options like star counts and timeframes which I do not need right now.

    Anyone interested? 

    Tuesday, September 5, 2017 9:07 AM

All replies

  • This forum isn't for scripting requests. What have you tried so far?

    We aren't just going to develop a script for you on demand, this forum is for help on specific scripting issues.


    P.S. If you're going to be using large data sets, I would suggest using a database such as Access or something similar.
    • Edited by I.T Delinquent Tuesday, September 5, 2017 9:41 AM
    • Marked as answer by NK-Seven Tuesday, September 5, 2017 9:59 AM
    • Unmarked as answer by NK-Seven Tuesday, September 5, 2017 9:59 AM
    Tuesday, September 5, 2017 9:31 AM
  • If someone is actually interested in what I am doing they will provide the script otherwise you will have the best answer.
    Tuesday, September 5, 2017 10:00 AM
  • If someone is actually interested in what I am doing they will provide the script otherwise you will have the best answer.

    Please read the following to set your expectations about technical forums. "Thie" technical forum.

    Please read this first: This forum is for scripting questions rather than script requests  
    Also find scripts here: http://gallery.technet.microsoft.com

    We do not provide solutions.  The forum is for questions.  If yo need a solution then you will have to contact a consultant for ssistance.

    If you rally just want to learn how to sort data then you can use the "Sort-Object" CmdLet: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/sort-object?view=powershell-5.1


    \_(ツ)_/

    • Proposed as answer by I.T Delinquent Tuesday, September 5, 2017 10:09 AM
    Tuesday, September 5, 2017 10:09 AM
  • Well, it seems noone is interested and the thread will probably be reported so I will let time decide when it actually does get deleted and I will do by hand. What good is a computer when you cannot utilize the full power of it?
    Tuesday, September 5, 2017 10:21 AM
  • What good is asking strangers to do your work for you. Listen the JRV and learn the basics of PowerShell, when you have tried to create a solution but have a question about a specific issue, we will be here to help.

    I have already suggestion using something like Access as that might be easier for you to use with no experience.


    Tuesday, September 5, 2017 10:27 AM
  • That's not a question of interest. You are asking us to provide a full written script for you. Your questions is not really difficult, each of us could write the code in a few minutes. But we want to see some efforts by your own and will help you with detailed questions.

    By the way: Write your star names in an array in the right order. Then you can append the index of the actual star name to your data and sort it that way.

    "What good is a computer when you cannot utilize the full power of it?"

    Yeah, that is why to learn programming.


    • Edited by hpotsirhc Tuesday, September 5, 2017 10:31 AM
    Tuesday, September 5, 2017 10:30 AM
  • I'm writing a program to assist the blind. I may not know how to code the ten lines or so to write this program like you yet at least I am doing something other than getting in a frivolous argument on the benefits of learning programming.
    Tuesday, September 5, 2017 10:46 AM
  • I know you are wondering how do I write a program if I do not know how to code so I will explain. Basically, the program is based on timing:

    1. Check weather conditions

    2. Check traffic

    3. Check store data

    4. Check prices

    5. Check commute time

    6. Check availability

    7. Cross reference all data for optimal: weather conditions, traffic, store data, prices, commute time, availability of item needed and give green light to the blind customer, whether it be on foot or drive.

    More conditions may be added for flexibility and comfort in retail setting such as outlay of the store, associates names and number of people shopping and perhaps additional information only available to the blind patron. 

    Tuesday, September 5, 2017 11:12 AM
  • That's not frivolous. Our aim is to help people, so this is the same as yours. But: PowerShell is a scripting language made for administrators and developers. It is not possible to write ready-to-use exe files out of the blue, that you only have to start. That means, even if we write something for you, you won't be able to use it without having some skills to adapt it for your needs. If you don't want to learn programming for your project (and this is understandable), you'll have to finde a programmer near to you, possibly an IT-student who will help you. 
    Tuesday, September 5, 2017 12:58 PM
  • I'm writing a program to assist the blind. I may not know how to code the ten lines or so to write this program like you yet at least I am doing something other than getting in a frivolous argument on the benefits of learning programming.

    Unfortunately we cannot write a script for you.  I posted a clue on how to sort data with PowerShell. 

    Your are asking for a solution and not asking a question.  Please step back and consider if there is a question you can ask about scripting.  Questions usually start with words like "How", "Why" or "When" and variations.

    It is clear that you have something you call data.  You have not mentioned what kind of data other than saying it is text.  What kind of text?  Is it in  a database, a text file, a piece of paper? 

    What have you tried so far?  Can you post your script?

    Have you looked in the Gallery?

    Have you tried to search for programs that can do what you ask?

    Please understand that what you are asking for is the wrong request for this type of forum.  You might try asking in a forum for a vendor that provides solutions.

    If your data is in Excel then all of this can be done very easily in Excel.  If you look in the Gallery you will find many scripts that can use PowerShell to access Excel data.  If you export Excel data to a Csv then the PowerShell "Sort-Object" command can sort as you have asked.


    \_(ツ)_/

    Tuesday, September 5, 2017 4:55 PM
  • I know you are wondering how do I write a program if I do not know how to code so I will explain. Basically, the program is based on timing:

    1. Check weather conditions

    2. Check traffic

    3. Check store data

    4. Check prices

    5. Check commute time

    6. Check availability

    7. Cross reference all data for optimal: weather conditions, traffic, store data, prices, commute time, availability of item needed and give green light to the blind customer, whether it be on foot or drive.

    More conditions may be added for flexibility and comfort in retail setting such as outlay of the store, associates names and number of people shopping and perhaps additional information only available to the blind patron. 

    What you are posting is not how to write a program.  It is just  shopping list.  Writing a program  is a set of technical steps that address the requirements of your "shopping list"

    If your issue is important then you really want to contact a trained consultant or technician. Without one-on-one guidance this will be very hard for you to understand.


    \_(ツ)_/

    Tuesday, September 5, 2017 4:58 PM
  • ok ten how do you explain this thread of mine https://social.technet.microsoft.com/Forums/windowsserver/en-US/70580de8-f66b-4878-ae47-130411e2f7a5/how-do-i-create-11-separate-files?forum=winserverpowershell

    I will try some of these ideas as far as the programming I will post when I come up with a better idea of what I am trying to accomplish.

    Tuesday, September 5, 2017 10:15 PM
  • ok ten how do you explain this thread of mine https://social.technet.microsoft.com/Forums/windowsserver/en-US/70580de8-f66b-4878-ae47-130411e2f7a5/how-do-i-create-11-separate-files?forum=winserverpowershell

    I will try some of these ideas as far as the programming I will post when I come up with a better idea of what I am trying to accomplish.

    That sounds like a good approach.  When you know better what you are trying to do and have a specific question then open a new question and we will try to answer it.

    Your question from five years ago was simple.  How do you split a file?  You current question is more of a request for a  vaguely specified solution.


    \_(ツ)_/


    • Edited by jrv Tuesday, September 5, 2017 11:10 PM
    Tuesday, September 5, 2017 11:08 PM