|
-
Apr 22nd, 2004, 03:08 PM
#1
Thread Starter
Hyperactive Member
Way over my head - stuck on this one...
Let's say you have this in a textfile
Code:
1.0
1.1
1.1-2.0
1.1-2.1
1.2
1.2-2.0
1.2-2.1
1.2-2.2
1.3
So in this example 1.1-2.0 and 1.1-2.1 are dependant on 1.1
I want to be able to delete a row from this text file but I need to rebuild it correctly again.
Deleting 1.1 now leads to this: (that's how far I got)
Code:
1.0
1.2
1.2-2.0
1.2-2.1
1.2-2.2
1.3
As you can see, 1.2 doesn't follow up 1.0 and so my app crashes...
The right output would be:
Code:
1.0
1.1
1.1-2.0
1.1-2.1
1.1-2.2
1.2
It's getting a bit to difficult for me. My brains are starting to boil.
Does somebody know how to write the procedure to do that last thing I explained?
Pls help me on this one...
Thx a lot allready...
Kind Regards,
Pieter
PS: If you found someone's answer helpful, please be so kind to rate that person.
Thanks.
-
Apr 22nd, 2004, 03:15 PM
#2
huh? Your post is full of contradictions! You say delete 1.1 but you say 1.1 should still be there? You said 1.2 doesnt follow 1.0 but in your example it does?
-
Apr 22nd, 2004, 03:19 PM
#3
Thread Starter
Hyperactive Member
The original 1.1 and follow ups get deleted
And the 1.2 and follow ups become 1.1...
Get it or do I have to give a more precise example?
Kind Regards,
Pieter
PS: If you found someone's answer helpful, please be so kind to rate that person.
Thanks.
-
Apr 22nd, 2004, 03:26 PM
#4
Thread Starter
Hyperactive Member
Let's say you have this in a textfile
Code:
1.0: Choice 1 without followups
1.1: Choice 2 with 2 followups
1.1-2.0: 1st followup of choice2
1.1-2.1: 2nd followup of choice2
1.2: Choice 3 with 3 followups
1.2-2.0: 1st followup of choice3
1.2-2.1: 2nd followup of choice3
1.2-2.2: third followup of choice3
1.3: Choice 4 without followups
So in this example 1.1-2.0 and 1.1-2.1 are dependant on 1.1
I want to be able to delete a row from this text file but I need to rebuild it correctly again.
Deleting 1.1 now leads to this: (that's how far I got)
Code:
1.0: Choice 1 without followups
1.2: Choice 3 with 3 followups
1.2-2.0: 1st followup of choice3
1.2-2.1: 2nd followup of choice3
1.2-2.2: third followup of choice3
1.3: Choice 4 without followups
As you can see, choice3 follows on choice 1 and then my app crashes
The right output would be:
Code:
1.0: Choice 1 without followups
1.1: Choice 2 with 3 followups
1.1-2.0: 1st followup of choice3
1.1-2.1: 2nd followup of choice3
1.1-2.2: third followup of choice3
1.2: Choice 3 without followups
choice3 actually becomes choice 2, choice 4 becomes choice 3,... because 1 choice got cut out...
Kind Regards,
Pieter
PS: If you found someone's answer helpful, please be so kind to rate that person.
Thanks.
-
Apr 22nd, 2004, 03:26 PM
#5
Ahh got ya now.
Umm..hmm
Well I would probably go about it by first sticking the whole thing in an array. After deleteing pull out the first to third characters in the string of every array element after the deleted one, turn it into a integer (using val function), subtract .1 from it, then rebuild the string in its place.
will need mid$ val(or CSingle probably) and instr$ functions.
-
Apr 22nd, 2004, 03:29 PM
#6
Thread Starter
Hyperactive Member
The thing is allready in an array, I allready got the code to delete the choice and followups. Then I get the 2nd code, but now i need a procedure to patch the missing choice...
Can you help me write it?
Another problem:
There could be choices named:
1.11, 99.1, 84.35,...
So the length can differ...
Kind Regards,
Pieter
PS: If you found someone's answer helpful, please be so kind to rate that person.
Thanks.
-
Apr 22nd, 2004, 03:32 PM
#7
Ill try to write something up for you before I leave work.
-
Apr 22nd, 2004, 03:36 PM
#8
Thread Starter
Hyperactive Member
Another problem I hit was this:
When you delete a followup that also has followups then the procedure you suggested won't work, I think.
1.0
1.1
1.1-2.1
1.1-2.1-3.1
1.1-2.1-3.2
1.1-2.1-3.3
1.1-2.2
1.2
When I want to delete the 1.1-2.1 choice, then you can't just take the first characters... Grmbl
Kind Regards,
Pieter
PS: If you found someone's answer helpful, please be so kind to rate that person.
Thanks.
-
Apr 22nd, 2004, 09:58 PM
#9
Let's look at this problem from another direction. Do you create the file? If so what does it represent? Can the format be changed?
-
Apr 23rd, 2004, 04:06 AM
#10
Thread Starter
Hyperactive Member
I've written a program that gives you choices.
1.0: Title
1.1: choice 1
1.2: choice 2
1.3: choice 3
Each choice can have followups and can be added through an admin app that creates the file.
1.0: Title
1.1: choice 1
1.1-2.0: Title2
1.1-2.1: Followup of choice 1
1.1-2.2: Followup of choice 1
1.1-2.3: Followup of choice 1
1.2: choice 2
1.3: choice 3
That means everything's variable... You can create as many choices as you want...
So Yes, I want to be able to edit the file, it represents a choice making mechanism, and no it can't be changed because the rest is allready written. It's only that last item I explained here that's a problem.
Kind Regards,
Pieter
PS: If you found someone's answer helpful, please be so kind to rate that person.
Thanks.
-
Apr 24th, 2004, 08:10 AM
#11
New Member
What does the array you are storing this information in look like?
I don't understand how you can do say..... Dim choice(4,2)..... and then change it to say..... Dim choice(4,2,5)
Kinda hard to help without knowing these things...
Post a sample of the code, and maybe i can help
-
Apr 24th, 2004, 09:56 AM
#12
Thread Starter
Hyperactive Member
The array I'm using is 1 dimensional...
Dim aryData() as string
The "data.dat" file (which I written above) is read in the array...
arydata(0) = line 1 of the file
arydata(1) = line 2 of the file
arydata(n) = line n of the file
... You get the picture
I will post a sample of my choice deleting procedure when I get the chance. I'm at work at the moment and forgot my notebook in my car.
Thx in advance
Kind Regards,
Pieter
PS: If you found someone's answer helpful, please be so kind to rate that person.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|