Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8961863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:59:26+00:00 2026-06-15T15:59:26+00:00

PLEASE…Help me group the values in this array I have a an array like

  • 0

PLEASE…Help me group the values in this array

I have a an array like this

    Arr(0) = 5
    Arr(1) = ATC^1
    Arr(2) = BTC^2
    Arr(3) = ATC^3
    Arr(4) = CTC^4
    Arr(5) = BTC^5

The end result I want is to change Arr(0) to be 3 which are the number of unique TC’s in the group. ATC,BTC and CTC. And I want each of the items for 1,2 and 3 to have the grouped values from the Array.

    Arr(0) = 3
    Arr(1) = ATC:1,3
    Arr(2) = BTC:2,5
    Arr(3) = CTC:4

I am trying to do this in MUMPs, so I have no inbuilt sort/group functions.

Even pseudo code will help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:59:27+00:00Added an answer on June 15, 2026 at 3:59 pm

    In MUMPS you don’t need sort function because array subscripts are being automatically sorted.

    So the easiest way is to create another array with sort dimension being first piece of data and value – second piece of data:

    for i=1:1:Arr(0) set piece1=$piece(Arr(i),"^",1), piece2=$piece(Arr(i),"^",2), Temp(piece1)=$get(Temp(piece1))_piece2_","
    

    after running that code you will get following array

    Temp("ATC")="1,3,"
    Temp("BTC")="2,5,"
    Temp("CTC")="4,"
    

    Then you traverse that array and build one you need:

    set i="",Brr=0 for  set i=$o(Temp(i)) quit:i=""  set Brr=Brr+1,Brr(Brr)=i_":"_Temp(i)
    

    You will get an array you need:

    Brr(1)="ATC:1,3,"
    Brr(2)="BTC:2,5,"
    Brr(3)="CTC:4,"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please help me arrange these 3 buttons horizontally like this photoshopped image: Please take
Please Help me to do this first i have this div <div class=loader alt=stat.php>
Please help me somebody to convert unicodestring into string This is how i am
Please i need help, this code below works fine on my localhost, php5.3+ but
Please look the following query: SELECT ID, START, END FROM TABLEA the result is:
Please help me with this update query. I COMPLETELY understand how redundant this is
Please help! I'm really at my wits' end. My program is a little personal
Please tell me why i am getting ClassCastException in this case I have type
Please have a look at this code : class Foo { public int a;
please help me resolve this problem: There is an ambient MSMQ transaction. I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.