Jump to content

Recommended Posts

I have this interesting problem, I think I know how to do it.

 

In a java class I took there was a lab on swapping the values of variables and if there were two variables, you needed a third temporary value holder.

 

So this project I'm working on has a row output, currently the individual values are outputted as a concatenated string but ideally they would be independent rows with accompanying buttons.

 

One of those buttons is a ^ symbol, when you press this, ideally the row is moved up in ID putting the previous ID in front or ahead.

 

The problem is that the ID's / rows are not necessarily in sequential order.

 

So, when I recall a set of rows that have random sequential values for example, 2, 5, 27, 41, 43

 

and those are outputted by themselves, now becoming 0,1,2,3,4 respectively or 1,2,3,4,5

 

So when I try to move 43 to position 2, that's 4 positions away or 4 clicks of the ^ button.

 

Now how do you deal with that 4 difference and the difference of 41... ? thereby, when the initial set of rows are recalled again, the order is now, 43, 5, 27, 41, 2 Of course the ID I think remains the same but the data is switched... ? yeah I have to draw some pictures, but this isn't a current problem to fix, later on down the road after I update the interface.

 

here is a drawing to explain, I'm more of a visual person

 

post-174107-0-90436500-1421058541_thumb.jpg

 

Any ideas would be appreciated, otherwise I will post my solution when I come to it. Or I don't figure it out and find one.

thanks

I don't know... I have one table that users write into.

 

There are generally five fields, although it will increase: ID, username, content, keyphrase, date

 

People can write in random orders so when a specific user pulls up their content, the ID's are off...

 

I don't know if it's pointless for me to re-explain again.

 

So you've got these row ID outputs

 

2,5,87,93,100,393,

 

and they are pulled by themselves so they could be treated as

 

1,2,3,4,5,6

 

Then, when the rows are swapped by the ^ button, they change in order and consequently their ID values change in the table I don't know if I can do that, would I need an empty row to use as a temporary place holder?

 


There are generally five fields, although it will increase: ID, username, content, keyphrase, date

 

People can write in random orders so when a specific user pulls up their content, the ID's are off...

 

That is the reason we use forms rather then one big text area; so the order and type of information can be controlled.

What do you mean?

 

The only textarea I use is "content", this accepts any strings, urls, paragraphs, etc... the rest are either Int's or Varchars

 

I have used the string concatenation solution temporarily as it was all that I needed but some suggestions came to mind which I view as a must for the tool to function correctly.

Edited by moose-en-a-gant
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.