Results 1 to 15 of 15
  1. #1
    jagrok is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2014
    Posts
    19

    Advanced sorting and creation of additional table

    Dear All

    I`m looking for help with creation of some advanced tables, with advanced sorting and with a lot off condition.
    Problem is that database contain 60.000 records and i would like to create using SQL, problem is that i`m only operating on the graphical access, not with the source of code.

    I have database with 2 tables
    Model and First Day of Sale is in strange standard MM.YYYY

    Model Day of Sale
    XX-ABC2-A 01.2010
    XX-ABC2-D 02.2012
    XX-ABC2-K 03.2013
    XX-ABC2-I 04.2010
    XX-ABC20-B 03.2010
    XX-ABC200-C 02.2009
    YY-ABD2-A 01.2009
    YY-ABD2-B 02.2008
    YY-ABD3 10.2012
    ABDZZZZ-A 06.2014
    YY-ABDZ-A 05.2014
    XX-11A222 03.2014



    I would like to add 3rd table called category and fill the field with some name for example Graphic-Card

    Model Day of Sale Category
    XX-ABC2-A 01.2010 Graphic-Card
    XX-ABC2-D 02.2012 Graphic-Card
    XX-ABC2-K 03.2013 Graphic-Card
    XX-ABC2-I 04.2010 Graphic-Card
    XX-ABC20-B 03.2010 Graphic-Card
    XX-ABC200-C 02.2009 Graphic-Card
    YY-ABD2-A 01.2009 Graphic-Card
    YY-ABD2-B 02.2008 Graphic-Card
    YY-ABD3 10.2012 Graphic-Card
    ABDZZZZ-A 06.2014 Graphic-Card
    YY-ABDZ-A 05.2014 Graphic-Card
    XX-11A222 03.2014 Graphic-Card




    After that i would like to add many condition for the table model, which will create for me additional table called CORE (Core it will contain some of letters from table model, but there are a lot off condition for names)


    Model Day of Sale Category Core
    XX-ABC2-A 01.2010 Graphic-Card XX-ABC2
    XX-ABC2-D 02.2012 Graphic-Card XX-ABC2
    XX-ABC2-K 03.2013 Graphic-Card XX-ABC2
    XX-ABC2-I 04.2010 Graphic-Card XX-ABC2
    XX-ABC20-B 03.2010 Graphic-Card XX-ABC20
    XX-ABC200-C 02.2009 Graphic-Card XX-ABC200
    YY-ABD2-A 01.2009 Graphic-Card YY-ABD2
    YY-ABD2-B 02.2008 Graphic-Card YY-ABD2
    YY-ABD3 10.2012 Graphic-Card YY-ABD3
    ABDZZZZ-A 06.2014 Graphic-Card ABDZZZZ
    YY-ABDZ-A 05.2014 Graphic-Card YY-ABDZ
    XX-11A222 03.2014 Graphic-Card A222




    As we can saw, some of models names have 7 characters, sometimes 9 or more or less, sometimes i want to get only 3 or 4 letters
    After that they will be available in database Model, Day Of Sale, Category, Core
    Next step is to sort by the table core and create additional tabel called as Year.
    Year will be created from the Day of Sale, and also will be sorted.

    Model Day of Sale Category Core Year
    XX-11A222 03.2014 Graphic-Card A222 2014
    XX-ABC2-A 01.2010 Graphic-Card XX-ABC2 2010
    XX-ABC2-D 02.2012 Graphic-Card XX-ABC2 2012
    XX-ABC2-K 03.2013 Graphic-Card XX-ABC2 2013
    XX-ABC2-I 04.2010 Graphic-Card XX-ABC2 2010
    XX-ABC20-B 03.2010 Graphic-Card XX-ABC20 2010
    XX-ABC200-C 02.2009 Graphic-Card XX-ABC200 2009
    YY-ABD2-A 01.2009 Graphic-Card YY-ABD2 2009
    YY-ABD2-B 02.2008 Graphic-Card YY-ABD2 2008
    YY-ABD3 10.2012 Graphic-Card YY-ABD3 2012
    YY-ABDZ-A 05.2014 Graphic-Card YY-ABDZ 2014
    ABDZZZZ-A 06.2014 Graphic-Card ABDZZZZ 2014



    After that i would like to assign for the same core minimum year and put it to the additional tabel such as ModelYear, which will be created.

    Model Day of Sale Category Core Year ModelYear
    XX-11A222 03.2014 Graphic-Card A222 2014 2014
    XX-ABC2-A 01.2010 Graphic-Card XX-ABC2 2010 2010
    XX-ABC2-D 02.2012 Graphic-Card XX-ABC2 2012 2010
    XX-ABC2-K 03.2013 Graphic-Card XX-ABC2 2013 2010
    XX-ABC2-I 04.2010 Graphic-Card XX-ABC2 2010 2010
    XX-ABC20-B 03.2010 Graphic-Card XX-ABC20 2010 2010
    XX-ABC200-C 02.2009 Graphic-Card XX-ABC200 2009 2009
    YY-ABD2-A 01.2009 Graphic-Card YY-ABD2 2009 2008
    YY-ABD2-B 02.2008 Graphic-Card YY-ABD2 2008 2008
    YY-ABD3 10.2012 Graphic-Card YY-ABD3 2012 2012
    YY-ABDZ-A 05.2014 Graphic-Card YY-ABDZ 2014 2014
    ABDZZZZ-A 06.2014 Graphic-Card ABDZZZZ 2014 2014

    The my question is how to do that ? Is it possible ?
    Is there chance that this final version will created additional fields in a few seconds or it will take a time for example 1h ?

    Many Many thank of anybody, who can join and help me with this problem.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why do you need to create tables? Why not just use queries?

    I can see where you want Year and Core to come from. Year will be easy.

    However, programmatically extracting Core will be difficult because of the inconsistent structure. Why was XX-11 dropped from XX-11A222?

    How are the ModelYear and Category determined?


    Year is a reserved word, should not use reserved words as names. Also, avoid spaces and special characters/punctuation (underscore is exception) in naming convention.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jagrok is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2014
    Posts
    19
    Quote Originally Posted by June7 View Post
    Why do you need to create tables? Why not just use queries?
    It could be query.
    I can see where you want Year and Core to come from. Year will be easy.

    However, programmatically extracting Core will be difficult because of the inconsistent structure. Why was XX-11 dropped from XX-11A222?
    well it's not easy to explain some for example it's related for the inching. If I had the same model but not 11 inch but for example 22 inch they I want to get a core A222 because there is a diferent with inch but model is still the same (teoriticaly)

    How are the ModelYear and Category determined?


    Year is a reserved word, should not use reserved words as names. Also, avoid spaces and special characters/punctuation (underscore is exception) in naming convention.
    it's only example I will remember it

    Thank you

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    If you can't explain it then can't program it. Need to have a set of rules for programming logic to extract the Core value and the rules need to cover every possible situation, otherwise you will just have to manually validate every entry.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    jagrok is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2014
    Posts
    19
    Quote Originally Posted by June7 View Post
    If you can't explain it then can't program it. Need to have a set of rules for programming logic to extract the Core value and the rules need to cover every possible situation, otherwise you will just have to manually validate every entry.
    Yeah but i`m not sure which information will be helpful for you, where i can read about condition ? of SQL ?

    But if You are looking for this table You can saw which condition must be met.


    Model Core
    YY-ABD2-A YY-ABD2
    YY-ABD2-B YY-ABD2
    XX-ABC200-C XX-ABC200
    XX-ABC2-A XX-ABC2
    XX-ABC2-D XX-ABC2
    XX-ABC2-K XX-ABC2
    XX-ABC2-I XX-ABC2
    XX-ABC20-B XX-ABC20
    YY-ABD3 YY-ABD3
    XX-11A222 A222
    YY-ABDZ-A YY-ABDZ
    YY-ABDZZZZ-A YY-ABDZZZZ

    I think for the evening i will prepare some condition.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I still don't know why XX-11 was dropped from XX-11A222 but none of the others drop the XX- or YY- prefix.

    Does that list represent every possible configuration for values?

    Examples of rules for parsing a string:

    First 4 characters.

    Start with character after first hyphen and end with character before second hyphen.

    etc.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    jagrok is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2014
    Posts
    19
    Quote Originally Posted by June7 View Post
    I still don't know why XX-11 was dropped from XX-11A222 but none of the others drop the XX- or YY- prefix.

    Does that list represent every possible configuration for values?

    Examples of rules for parsing a string:

    First 4 characters.

    Start with character after first hyphen and end with character before second hyphen.

    etc.
    Let`s sum up, what i have done after read your post.

    Below you will find some categories.
    Additionally i attach category.zip to this subject file which already have inputted the same but there are colored a core for red colour

    For some categories i decided to follow only for some letters, digits(numbers) becouse core is still the same, but only size of screen will be changing for the choosen models.
    I think the attached list in XLS show you all possible configuration.

    In my opinion i think it should be go like this, but i`m not programmer and i haven't any knowledge about IF,OR,AND etc...

    For category A and B there are the same rule:
    start with letters after first hyphen, skip the first two numbers and after the last number skip the rest
    Or
    Start with letters after first hyphen skip first letter, skip two numbers and after the last numbers skip the rest
    For category C
    Start with letters, include hyphen, include letters and numbers but skip after numbers rest of the characters
    For category D
    Start with letters, include hyphen, include numbers and letters and include one number, after that skip rest of characters
    For Category E
    Start with letters, include hyphen, include all of the characters, and finish on the last digits.
    For Category F
    Start with letters, include hyphen, include all of the characters, and finish on the last digits and start with letters, include hyphen, letters and finished after your first pack of digits.

    Code:
    CAT A.
    AB-B21CD0C
    AB-32BCD000D
    AB-26BC0DE
    AB-00B000C
    AB-00BC000D
    AB-00C000D
    AB-B00C0D
    AB-B00CD0E
    AB-B00CDE00
    AB-B00E0D
    AB-B00CD00E
    AB-B00CD0EF
    CAT B.
    AB-B00CD00E
    AB-B00DE00F
    AB-B00C00D
    CAT C.
    BC-CD00EF0-G
    BC-CD00FG0-H
    CAT D.
    CD-123DD0FGH
    CD-123DD0FGJ
    CD-120DD0FGI
    CD-127DD0FGB
    CD-127DD0FGY
    CD-128DD0FGD
    CAT E.
    DE-AB1234ABC
    DE-ABC123ABC
    DE-ABC234ABC
    DE-CD1234ABC
    DE-ABD123ABD
    CAT F.
    EF-A123BC-D
    EF-A234BD-E
    EF-A345BE-F
    EFG-BC123DEF

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    And how should I know what category a record belongs to? Need another rule. If the indicator is the second letter in the prefix, that does not fit category A.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    jagrok is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2014
    Posts
    19
    Quote Originally Posted by June7 View Post
    And how should I know what category a record belongs to? Need another rule. If the indicator is the second letter in the prefix, that does not fit category A.
    Sorry it`s not clear for me, have you download a file ?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Does not answer my question.

    The Excel shows AB-B00CD00E listed under both Cat A and Cat B.

    How am I to know which AB- values are Cat A and which are Cat B or both?

    The rules you already listed will be complicated programming.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    jagrok is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2014
    Posts
    19
    Quote Originally Posted by June7 View Post
    Does not answer my question.

    The Excel shows AB-B00CD00E listed under both Cat A and Cat B.

    How am I to know which AB- values are Cat A and which are Cat B or both?

    The rules you already listed will be complicated programming.


    Ok, lets explain.
    Please back to the first topic, i mentioned that i want to create automaticly column "Category".
    I do not tell you that i will import this data as separate category to the other tables.
    So category A,B,C,D...Z i will import separtly, i think it will be much easier then.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Have to know the category a record belongs to in order to determine which rule to apply for parsing the string.

    So the very first rule we need is one that determines which category a record belongs in.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    jagrok is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2014
    Posts
    19
    Yes but if we will use category as separate database then we can determine the rule.
    Create query which will give a name for categories, connect all database to one and then we can set the rule of the names.
    Is it ok ?

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Does not make sense.

    Look at value AB-B00CD0E - what category does it belong to and why?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    jagrok is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2014
    Posts
    19
    I send you some private information to show you, on the truth names examples.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Additional entries in table one
    By Cyberice in forum Access
    Replies: 9
    Last Post: 02-16-2014, 05:37 PM
  2. Replies: 8
    Last Post: 07-18-2013, 01:52 PM
  3. adding an additional sub table
    By rmayley@puroclean.com in forum Access
    Replies: 1
    Last Post: 06-10-2013, 03:33 PM
  4. Creation of additional empty
    By Lupson2011 in forum Access
    Replies: 1
    Last Post: 09-02-2011, 10:11 AM
  5. Advanced sorting
    By Adele in forum Queries
    Replies: 3
    Last Post: 08-04-2011, 03:25 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums