Diamond clarities are not ordered by alphabet

Because of this I need a way to sort diamond clarities (a views field) by a JOINed table that associates each clarity with a number and then the Views Sort actually sort by this JOINed table.

is this even possible?

Comments

marcvangend’s picture

How is the diamond clarity information added to the node in the first place? I suppose it's a system with fixed names, like the GIA scale? In that case, I would start with the taxonomy module to create a vocabulary called 'clarity'. Next, you add all clarity grades as taxonomy terms and you sort the clarities correctly within the vocabulary. Finally, in views you can choose Taxonomy: Weight as sort criteria.
Hope that helps.

netentropy’s picture

excellent idea!

the problem I for see and maybe you can see this more clearly

I will be mass loading diamonds with NaviCat so originally I was trying to make the clarities a content field

so i what I sort of need it a content field that acts as a taxonomy also

marcvangend’s picture

I don't know navicat... can you explain how it works? Are you inserting directly into the database, or do you have a drupal module running which gathers the data and writes it using node_save(), or are you using yet another method?

netentropy’s picture

it will serve it directly to the database from a spreadsheet,

if I knew of a way to upload a spreadsheet into a node format and save it i WOULD! but alas I don't

navicat will allow me to pull fields from EXCEL and put them in any database row i choose.

marcvangend’s picture

If you know which tables to change, you can import node-term relations into the database just like other data.

Be aware though that you will have to understand the drupal database structure really, really well if you want to insert node into the database directly. I have seen examples of people who forgot to update the sequences table for instance, which led to a big mess. It is much safer to write a module that builds a node object and saves it to the database using node_save. I think the datasync module should be able to help you with that (http://drupal.org/project/datasync, I never tried it myself) but you can also find some example scripts here on drupal.org.

netentropy’s picture

i would like to know more about this

"ite a module that builds a node object and saves it to the database using node_save"

do you think it is possible to build a module that can parse a 1000+ lines of CSV spreadsheet

and push each row into the proper database table?