Home

Cardbox Talk

 

CardboxForumsCardbox Talk > "Saving when sorted"

Saving when sorted

Current user: [none]
Register / Log In · Help

Posted By Post

JayCee

5-May-2011 11:23

Can anyone please explain very simply for me how I can save my database after sorting it into alphabetic order on names so that it opens with that sequence every time.

Thanks - using cardbox 3.0

bert

5-May-2011 12:32

I think this can easy:
- Make a macro that sorts the database the way you want.
- You can easy make this macro. When the database is unsorted, record it.
- If you add a button that starts your macro (in your format(s) of the button bar) it is easy to (re)sort it whenever you want.
- For auto sorting at startup, place the name of that macro in Menu Tools - options - startup - startup macro.

Another way:
In some cases I write all records sorted to a temp file, make the database empty, then read the temp file. Needs a more complex macro to do this easy. For not big databases, a reasonable alternative.

regards
bert

Iuliana

5-May-2011 14:21

Cardbox 2.0 had an easily accessible "remember" option, conveniently accessible from the Toolbar, allowing to set it to remember the configuration you wished it to open in. In Cardbox 3 this feature was moved to the File-Worksheets menu, a bit more complex to set up but with added capabilities.

By default, Cardbox 3.0 automatically remembers the exact configuration (opened files, selections/sort orders/tags...)it was in when you last closed it. You can, however, set a default configuration to make Cardbox open as desired (in your case - Level 0 - alphabetically sorted), regardless where it was when you closed. The set up is wery well explained in the "Workspaces" section in the online Cardbox help (or the Cardbox book),. If you need additional help with the set-up, please feel free to send me an e-mail off-list and I will be happy to help.

bert

5-May-2011 15:49

Iuliana did forget that added records in Level 0 stays at the end of your records.
They are not automaticly right sorted. So a sort macro is I think the best option.
regards
bert

John Francis

5-May-2011 16:30

My suggestion:

After sorting, go to FILE - EXPORT. Check the "Cardbox internal" button, and export to a suitably named file.

Delete the original database (after saving a backup copy, of course!) and then import the new file.

I THINK that should work, but take no responsibility if it doesn't.

Yours,

John Francis

Mary Doyle

5-May-2011 21:32

I would think that Bert's idea is best. The startup macro he suggests is very simple, for example:
OpenFile "c:\appointment.fil"
Sequence "+dt"

You could also add other things to this macro like specifying a particular format

Regards,

Mary

JayCee

25-Jul-2011 12:37

I have been experimenting somewhat but it still baffles me.

The manual says set up your database as you want it so I did, I sequenced it to alphabetic on surname - then it says give this workspace a name, which I did, then it said to tick a box to use this workspace when the database is opened so I ticked it.

But it still opens with the records in the order they were added, not in the alphabetic name order that I had saved in that workspace.

I did manage once before to export it in the order I wanted and then import it into a new file in that order but I have forgotten how to do that now and daren't mess about too much for fear of losing the records I have. I can't get to grips with macros and the manual is like chinese to me in some places.

Although I use the database every day I am not using the program if you see the difference so I am finding it hard to get to grips with; for instance I have a format which I sometimes view and I have changed a couple of boxes in that OK but I can't find out anywhere how to rename the view so whereas I am now looking at a view entitled 'Grades 2010' it is actually showing me the 2011 grades (which is what I want) from my format changes - but I would like to rename the view as well.

Surely it can't be this difficult to get the database to start up with the records sorted how you want them?

Any suggestions for this not very experienced user?

bert

25-Jul-2011 13:52

First: all this is perfectly written in the Cardbox book + help file.
It is amazing to me that people are spending hours to work with MS Word and not even 5 minutes take time for reading the Cardbox manual...

Although:
Renaming a view (format) is not possible. A little old fashioned.
However, the workaround is:
- change to the format you want to rename (let's say 2010)
- menu edit
- duplicate format
- save format
- give it the new name (2011)
- change back to format to 2010
- menu edit
- delete format (2010)
Your are back in 2011.

If you want your database at start up sorted on one or more fields you can make a startup macro. This is not very difficult. However, new records are always added at the end until you sort the records again (like in any other database).

So I think you better can add a sort macro in your button bar which sorts your records again whenever you push on it.

How to make this?
- push F5
- Tab Manage
- New Macro
- Copy and paste this line into the macro window:

ActiveWindow.SetSequence "*+YOURFIELDNAME",cbxSequenceRefresh

Change "yourfieldname" in to the field you want to sort.
Do not remove the + and the quotes.

-button SAVE
-click FIRST on "This database"
-enter a name like SortOnField
-button SAVE
-button Close

Your macro is ready now.

The easy start your macro:
Menu: TOOLS
- Toolbar
- Tab this computer
- Scroll in the button list to last button (not in preview)
- Push button Add
- Help text: SORT ON FIELD (your fieldname)
- Bullet action: play a macro
- Click on just saved macro SortOnField
- Button Select
- If you wish: change button image (push on grey button)
- button ok

With added button you can sort directly any time on "yourfieldname"

I hope this will help you.

Very a pity is the absence of the DOS Cardbox Plus 4.1 sort option "This Record". That allowed you to sort records and after sorting still the same record was active. It was easy for finding out in what alphabetically context a record was.
But this lack is to solve with a more complex macro (which I use very often).

regards
bert

JayCee

26-Jul-2011 08:55

Thanks Bert, that looks simple enough for me to follow.
But there may be a problem as when I press F5 I just get a window offering to play a macro but there are none listed and I can see no Manage tab.
Is this because I am using the home version and it doesn't work in that?
By the way I have read the manual but as I am very new to using databases a lot of it goes right over my head; and I use LibreOffice not Word but have used word processors for donkeys years so am happy using that.

JayCee

26-Jul-2011 08:56

I apologise Bert, I forgot to mention that the renaming trick works well, thank you very much for that.

bert

26-Jul-2011 09:27

Indeed, manage macro tab is not available in Home Version.
However, also in Home Version you can make this . On a different way.
Tonight I will make a new description using a home version.
regards
bert

bert

26-Jul-2011 20:34

Ok, How to do this in Home Version?

1 Close Cardbox
2 Open NotePad
3 Copy and paste this line into your Notepad "document":
4 ActiveWindow.SetSequence "*+YOURFIELDNAME",cbxSequenceRefresh
5 Change "yourfieldname" in to the field you want to sort.
6 Do not remove the *+ and the quotes etc.
7 Save this file in same folder as where your database is stored with this name:
SortOnField.CBW (NOT as .TXT!)
8 Start Cardbox

Adding a button in your toolbar is not possible using your Home Version.
There is a workaround. If you make such a button on a computer with a professional Cardbox license, you can export the right registry key and read it on your home version computer. That will work. This is only possible for experienced users I think.
So, an easier solution now.

You can also add buttons in your formats.
To add a button in your format:
1edit format
2menu insert - pushbutton
3Draw with your mouse a rectangle or so by pushing left mouse button and keep it pushed while moving it. Release mouse button when you think the button size is ok.
4Enter in the dialog which appears right under your screen a description like "sort macro"
5Enable button bullet: only when viewing (while you edit a record you cannot sort)
6If you want to make your button nicer then grey, you can paste a SMALL!!! graphic using the Paste button (if it's on your clipboard), or read a very small graphic file using button "Read from file".
7Image size bullet: only interesting when you use a graphic on your button - try something, it does not damage
8Switch to tab "Action"
9Leave all things - only use button select macro now
10If you did all things ok, then you see in that dialog your Notepad saved file SortOnField. Click on it and push on select button
11Then button ok. Your button is ready.
12Then save format. Your button should start the sort macro now. Not when your record is edited of course...

For later button modifications: If you double click on that button while you are in edit format mode, then you can change all settings of the button afterwards (nice for experimenting with graphics). If you want to write text on your button, use MS Paint, type a text with small fonts, make a selection of it, copy it to clipboard, and paste it as mentioned.

If you want to add that button in every format, there is an easy way:
-Edit Format (in which that button is you want to copy)
-Right click on the button
-Copy (the button data is now on the clipboard)
-Quit without saving
-Change to the format in which you want to add that button
-Edit format
-Then ctrl V
-move the button to the right place.
-Save format. Done!
Success
Bert

JayCee

27-Jul-2011 09:19

Hi Bert,

Thanks for that, I have followed your instructions and now have a button to push but when I push it it comes up with 'Running Macro:SortOnField.CBW - Macro not found'.

As you instructed the file SortOnField.CBW is in the same directory as NCCA.fil and NCCA.fmt.

In the Pushbutton properties I have in the Action window Play a Macro selected and All Macros selected with SortOnField.cbw in the Macro name field.

I must have made an error somewhere but I have looked and looked and can't see anything glaringly wrong.

Help!!

bert

27-Jul-2011 20:20

Try this:
Edit Format
Right Click your button
Dialog Pushbutton properties choose tab "action"
In text line "Macro Name" is written I think SortOnField.CBW

If this is right, remove .cbw
then
ok, save format
Try again.

Success
Bert

JayCee

28-Jul-2011 08:21

Hi Bert,

I have edited the 'action' window as you say by removing .CBW which just leaves SortOnField in there but it still comes up with 'Running Macro:SortOnField - Macro not found'.

By the way when I click on the Select Macro... button in the 'action' window there are no macros listed in there.

Sorry to be a pain

JayCee

bert

28-Jul-2011 13:57

Stupid mistake...
Rename your SortOnField.CBW in SortOnField.CBS (with Win Explorer or so).

Then you'll see the things different.
Regards
bert

JayCee

28-Jul-2011 16:18

************Success************

Well done Bert, it works, brilliant, thanks so much

JayCee

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home