blackberry reading a text file and updating after sort - blackberry

I am successfully able to read and print the contents of a text file. My text file contains 5 data entries such as
Rashmi 120
Prema 900
It must sort only the integers in descending order and swap the respective names attached to them. the first column of serial number must remain the same. Each time a new entry is made that score must be compared to the existing 5 records and placed accordingly with new name and score.
Since this is blackberry programming and blackberry APIs don't support Collections.sort,please tell me how do I do this. I tried using SimpleSortingVector but I am unable to put it into coding form.

i believe u need to start with your own logic like
1) sorting depends on comparison
2) before making any comparison u need to split each string by spaces
3) after splitting save the name and numbers in different arrays
4) compare the numbers and accordingly do sorting
5) after this merge the array contents using indexing
m just giving u a way may be its not the perfect but drilling down may refine logics and usage of the api

Related

Reorganizing Google Sheets data dynamically

I'm currently working with Google Sheets to import data from Contact Form 7 in Wordpress. All the data is coming over fine, but I wanted to see about formatting it in more user friendly fashion. I've simplified the example a bit, but the gist of the form I have created allows the user to request multiple versions of a graphic file with different wording as needed, up to 5(my example has just 2 for simplicity sake).
All the data is imported using the CF7 variables and ideally I wanted to clean this up a bit. What I had thought of as a solution was creating a second sheet that pulls in this data submitted in the first sheet into a more user friendly format, as I intended to use this as a work form for a designer to create the requested graphic once the data is received. With each request the name/department/email/date all stay the same, but I'd like to display the version and line 1 and 2 data on another line. Is it possible to reorganize data like this on the fly, so when a new form is submitted and adds data to sheet 1, sheet 2 would then update with the properly formatted info?
Is this even possible to do? I did some looking online, but didn't anything that really related to this type of data manipulation.
Solution:
Here's what ended up working for my example
=ArrayFormula(QUERY({
Sheet1!A2:D,Sheet1!E2:G,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!H2:J,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!K2:M,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!N2:P,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!Q2:S,ROW(Sheet1!A2:A)
},"select Col1,Col2,Col3,Col4,Col5,Col6,Col7 where Col5<>'' order by Col8",1))
Yes, it's possible.
One way is to use arrays and the QUERY function.
For simplicity, let say that
Columns A and B have the general information of the order
Columns C and D have the data for version 1
Columns E and F have the data for version 2
Columns G and H have the data for version 3
On the output sheet, add the headers.
Below of them add a formula like the following:
=ArrayFormula(QUERY({A2:B,C2:D,ROW(A2:A);IFERROR(LEN(A2:B)/0),E2:F,ROW(A2:A);IFERROR(LEN(A2:B)/0),G2:H,ROW(A2:A)},"select Col1,Col2,Col3,Col4 where Col3<>'' order by Col5"))
References start on row 2 to skip the headers to avoid to include them on the output sheet.
ROW(A2:A) is used to keep the order
IFERROR(LEN(A2:B)/0) is a "trick" used to "hide" the order (general information) data for the second and following rows for the same order. On the select parameter of the QUERY function, it's referrey as Col5 on the order by clause.
It's assumed that lookup-choice-1 will never be empty.
NOTES:
If more columns were added, the column numbers should be updated accordingly
Don't use the order by clause to sort the result by the general information columns because the "trick" to hide the "labels". If you need to apply a sort, do it' before applying the above formula, you could do this by sorting the source range through the Data > Sort range... feature, so the data is sorted before it's transformed by the above formula.
See also
Sort and filter your data, an official help article describing Data > Sort range...

Google Spreadsheet Re order Columns

I'll explain an example of the situation before I ask the question.
If I have a pile of 5 numbered boxes and I scan them into a spreadsheet in the following order. 4,2,3,5,1
I copy that list into another program which adds more info to each number (which is what I want) but messes up the order. So now it is 3A,4D,1C,2B,5E.
Is there a formula I can use to reorder my new list to the original? I want to keep the original order as I print labels for these boxes and this would keep the order, meaning ordering both numerically won't work.
Thanks,
Graeme
I'd recommend an HLookup. Look for the character in your original list and add "*" which is a wild card for the second character.
Assumptions:
The first character is unique in the set.
Each value is in its own cell.
The original list is retained after intermediate program runs.

Multiple response crosstabs/frequencies based on categorical variable in SPSS

I've just started using SPSS after using R for about five years (I'm not happy about it, but you do what your boss tells you). I'm just trying to do a simple count based on a categorical variable.
I have a data set where I know a person's year of birth. I've recoded into a new variable so that I have their generation as a categorical variable, named Generation. I also have a question that allows for multiple responses. I want a frequency of how many times each response was collected.
I've created a multiple response variable (analyze>multiple response > Define variable sets). However, when I go to create crosstabs, the Generation variable isn't an option to select. I've tried googling, but the videos I have watched have the row variables as numeric.
Here is a google sheet that shows what I have and what I'm looking to achieve:
https://docs.google.com/spreadsheets/d/1oIMrhYv33ZQwPz3llX9mfxulsxsnZF9zaRf9Gh37tj8/edit#gid=0
Is it possible to do this?
First of all, to double check, when you say you go to crosstabs, is this Analyze > Multiple Response > Crosstabs (and not Analyze > Descriptive Statistics > Crosstabs)?
Second, with multiple response data, you are much better off working with Custom Tables. Start by defining the set with Analyze > Custom Tables > Multiple Response Sets. If you save your data file, those definitions are saved with it (unlike the Mult Response Procedure).
Then you can just use Custom Tables to tabulate mult response data pretty much as if it were a regular variable, but you have more choices about appropriate statistics, tests of significance etc. No need in the CTABLES code to explicitly list the set members.
Try CUSTOM TABLES, although this is an additional add-on modules that you need to have a licence for:
CTABLES /TABLE Generation[c] by (1_a+ 1_b + 1_c)[s][sum f8.0 'Count'].

Automatically updating Data Validation lists based on user input

I have a very large data set (about 16k rows). I have 10 higher level blocks and within each block I have 4 categories (10 rows for each) which use Data Validation lists to show items available in each category. The lists should automatically update based on user input. What I need your help with is that I want to use the same data set for each block and preferably a least calculation/size intensive approach. I have put together a sample file that outlines the issue with examples.
Sample File
Thank you for your help in advance.
Okay, I've found something, but it can be quite time consuming to do.
Select each range of cells. For instance, for the first one, select B3:B18 and right click on the selection. Find 'Name a Range..." and give it the name "_FIN_CNY". Repeat for all the other ranges, changing the name where necessary.
Select the first range of cells to get the data validation, and click on "Data validation", pick the option "Allow: List" (you already have it) and then in the source, put the formula:
=INDIRECT($G$4&"_CNY")
$G$4 is where the user will input. This changes as you change blocks.
_CNY is the category. Change it to _CNY2 for the second category.
Click "OK" and this should be it. Repeat for the other categories.
I have put an updated file on dropbox where you can see I already did it for the data of _FIN for categories CNY, CNY2 and INT and did the one for _GER as well. You'll notice the category of INT for _GER doesn't work, that's because the Named Range _GER_INT doesn't exist yet.

How do I use Macros to copy select data from one worksheet to another on Excel?

I need to create a Macro on Excel to keep track of changing contracts. There's already an existing macro that updates the contract data so I need to create another macro...
There are two worksheets. On the first worksheet is a bunch of data with each row representing one contract. There are several categories (Contract #, Date, Price, etc.).
I need to write a Macro that finds only certain contracts fitting specific criteria (like, contacts at a specific date or a certain price), copies and pastes them into the second worksheet.
What I've done so far:
I've figured out a bit of a convoluted way of doing it using IF and OR functions. So using OR I specify the criteria and IF to basically find the corresponding data if things are TRUE.
When things are false, a 0 is entered. The problem is I have tons of rows of zeroes---rows/contracts that didn't fit the criteria. When I try to use the find command (CTRL+F) to find, highlight, and properly delete (with rows shifted up) all the zeroes, Macro doesn't record it and I'm not sure how to write it in the code.
Any insight would help!
Just change your formula to:
=IF(OR(TermSheet!$E40=41220,TermSheet!$M40="bpxx"),TermSheet!E40,"")

Resources