Get the n'th row for JavaScript and different sorting options

Hello,

for various sorting tasks I would like to achieve the following and have these questions:

how can I address in javascript the content of the last row of a given column? The number of rows should not matter.
I would like to use this to read the cell contents (a number) and feed it into a javascript formula.

How can I split a column in half in such a way that the first half remains and the second half is next to the first column as a second new column?

How can I reverse the order of the rows within a column?

I experimented with the transformation filter but could not achieve this.

I would be very grateful for any advice.

Kind regards
yosimo

Currently the Javascript transform can only work on one row at a time. We intend to address this in future with a more advanced Javascript transform. Until then there there may be another way to do what you want. Perhaps you can tell us a bit more about what you are trying to achieve.

Use the Split Col transform to split the column into 2 columns and then use the Remove Cols transform to remove the original column.

Iā€™m not sure what you mean by ā€˜within a columnā€™. Can you give a simple example?

I want to sort a sequence of numbers in the way described here
http://boooks.org/index.php?page=21&lng=1
under ā€œBinding Method: Saddle Stitchā€.

In Excel I create a number series, which I load into EDT and transpose it to get a column. Now I want to use a JavaScript algorhytm to generate the new number sequence.

The JS-algorythm is known to me. But it needs the specification of the total number of rows (as well as the specification to ā€œNumber of pagesā€ in the Page Order Calculator. If there are 480 rows, then the number 480 should go into the JS)

I think Split Col Transform splitted the content of a cell. What I mean is to put the second half of all rows next to the first half as a separate column (like Excel-sheet column and D).
https://abload.de/img/screen1-2koein.png

By this I mean to reverse the order of the cell contents within a column (like in excel sheet column F).

My goal is to bring together the first half of the column with the inverted second half of the column as shown in column H in the excel sheet.

Thanks a lot for your help!!!
Regards yosimo

(Iā€™m missing a preview in the posting editor :face_with_raised_eyebrow:)
(and unfortunately I can only put two linksā€¦)

Currently you would need to add an extra column with the total number of rows. You can do that like this:

count-columns.transform (2.8 KB)

Itā€™s a bit kludgy, but it works.

You could use Filter or Slice to create 2 datasets, add a row number to these new datasets using Row Num and then Join them using the row number as a key. It depends on what you want to do with any other column values.

split-col.transform (3.5 KB)

In that case you can get the bottom Row Num to number descending instead of ascending (or Sort it by descending order) before the Join.

I think that is because you are a new poster on the forum.

I am very pleased with your insanely fast reply.

There is something wrong with theTransformation Replace. Maybe it has to do with the fact that you use letters in your example, but I only use numbers?

Because I canā€™t upload as a newbie here the link to my transform file.
https://we.tl/t-ofZkGJvJbT

to split-col.transform

I had the transformation filter already in processing, but had let it be again, because I have to specify the value for filtering manually. This makes it unsuitable for processing that is as partially automated as possible.

I would also like to have a possibility to determine the value automatically, a filter operation like n-Rows/2.
But the subsequent transformations are interesting again.

Thank you very much.
yosimo

If the column is all numbers it will compare values numerically. If the column is a mix of numbers and text it compare everything as text (alphabetically, not numerically). Perhaps that is the problem?

I downloaded the .transform file, but it isnā€™t much use without an input file to go with it.

You can use the count-columns.transform (above, should have called it count-rows.transform!) to count the rows, then Calculate or Javascript to calculate n - Rows/2 (being careful about rounding odd numbers!).

I didnā€™t have a header in the original Excel file - I think that may have been the error.

https://we.tl/t-UmBltudvaa

Input is now from Clipboard

Sorry. I thought you were talking about Filter. Replace treats everything as text.

Is it working correctly now?

Hi,

This transform will give the output as you described in the Excel file screen shot.

Solution.transform (12.3 KB)

1 Like

No, I probably havenā€™t gotten the composition of the transformations and their options right yet. Itā€™s a bit time consuming to dig deeper into it.

Wow, thatā€™s great, and thereā€™s certainly a lot of work that went into it. It also shows that itā€™s not so trivial after all, when it takes so many transfomations. My respect. (for me these are the first steps with EDT)

I tried now to use e.g. 1-480 from the clipboard instead of 1-20, then the first transformation with the javascript does not update. A run-button appears only in Clipboard, where I copied the data, but in the following transformations no run-button appears anymore. It still shows only the numbers 1-20.
Why is this? How do I update the transformations to the new input values?

I think @Anonymous hard coded the number of rows into their example as an extra column. See my count-columns.transform file above for how to do this dynamically.

Hi,

I have auto run disabled that is why it is not running the later transform, follow the following steps

image

Here is with 480 numbers, there is no hard coded numbers, you can have as many numbers as you like that EDT can handle with your computer memory.

Just remember that, you should have Numbers as Header, when you copy new numbers to clipboard to be pasted in the transform for example;
Numbers
1
2
3
4
and so on

Solution.transform (16.3 KB)

Hi,

@Admin, no need for count-columns.transform. I simply used the Meta Info: Every Row with $(DataRows) in the Clipboard, so when one copy new data, you get extra column Meta Info with total number of rows automatically, which I used to calculate the half, so itā€™s dynamic.

1 Like

Good call. I had completely forgotten about $(DataRows). ;0)

1 Like

@Anonymous
Hmm, importing new values works, but the transformations still donā€™t update.
Even when I press the button to run, nothing happens.

Ohh, I finally got it to work: I had to select all the transformations at once first and then press the run button. I didnā€™t know that. I thought if I changed something up front, then all subsequent transformations would update automatically.

My next step will be to implement the task with the JS algorithm.

Until then though, I am helped for now.

Many thanks @Admin and @Anonymous :clap: :clap: :pray:

1 Like

Hi,

You need to press the middle button
image
on the top tool bar and it runs all the transformation that need to run, donā€™t have to select all the transform first to run it.

I disabled auto run, because I donā€™t like to be interrupted after each 1 to 5 seconds (maximum auto run delay) when I am adding, updating transforms.

So simply copy your data first to clipboard and then import it into the Clipboard input as mentioned in my previous post and simply click on the Middle Play button icon on the tool bar or press the hot key as shown in the Run menu (Run Unprocessed Ctrl+R) and all the transforms will get updated.

1 Like

Yes, thatā€™s how it works now.
Thanks for the detailed instructions!

Regards yosimo

2 Likes