High scores table without name repeat

Hello there,
I have some code which fills a high scores table.. we've decided to give away a prize to the top ten people in the high scores table.. the problem is that people are playing repeatedly and fillnig the high scores table with their name, this makes it unfair to other players as they can't manage to get onto the table !!
Is there a way I can modify my code to ignore the same name should it appear and skip to the next non repeated name(pseudo) and score ??
My text boxes are called pseudo1 - pseudo10 and score1 - score10
Many thanks in advance for your help below is my code :-
for (var p:uint = 1; p <= 10; p++) {
          var currentPseudo:String = "pseudo" + p;
          var currentScore:String = "score" + p;
          if (event.target.data["pseudo" + p]) {
               highScoresPage[currentPseudo].appendText(event.target.data["pseudo"+p]);
          if (event.target.data["score" + p]) {
               highScoresPage[currentScore].appendText(event.target.data["score"+p] + " points"/*/1000 + "s"*/);
          } else {
               highScoresPage[currentPseudo].appendText(" \n");
               highScoresPage[currentScore].appendText(" \n");

I find using Dictionary class for filtering unique names very useful. The code below shows that. Note how array is sorted in descending order:
var scores:Array = [];
scores.push( { name: "Peter Smith", score: 32 } );
scores.push( { name: "Amanda Smith", score: 112 } );
scores.push( { name: "Peter Smith", score: 23 } );
scores.push( { name: "Jerry Pak", score: 45 } );
scores.push( { name: "Peter Smith", score: 80 } );
scores.push( { name: "Martin", score: 78 } );
scores.push( { name: "Andrei", score: 99 } );
scores.push( { name: "Andrei", score: 65 } );
scores.push( { name: "Martin", score: 76 } );
scores.push( { name: "Amanda", score: 10 } );
scores.push( { name: "Peter Smith", score: 73 } );
// this sorting assures that only highest score for the same name will be presented
// default sort is ascending
scores.sortOn("score", Array.NUMERIC);
var uniquePlayers:Dictionary = new Dictionary();
// this creates unqie entries
for each(var obj:Object in scores) {
     // each element is entered only once
     uniquePlayers[obj.name] = obj;
// reset array
scores = [];
// populate with unique names
for (var key:String in uniquePlayers) {
     scores.push(uniquePlayers[key]);
scores.sortOn("score", Array.NUMERIC | Array.DESCENDING);
for each(obj in scores) {
     trace(obj.name, obj.score);

Similar Messages

  • High Score Table: Writing a Simple Text File with Flash and PHP

    I am having a problem getting Flash to work with PHP as I need Flash to read and write to a text file on a server to store simple name/score data for a games hi score table. I can read from the text file into Flash easily enough but also need to write to the file when a new high score is reached, so I need to use PHP to do that. I can send the data from flash to the php file via POST but so far it is not working. The PHP file is confirmed as working as I added an echo to the file which displayed a message so I  could check that the server was running PHP - the files were also uploaded to a remote server so I  could test them properly. Flash code is as follows:
    //php filewriter
    var myLV = new LoadVars();
    function sendData() {
    //sets up variable 'hsdata' to send to php
    myLV.hsdata = myText;
    myLV.send("hiscores.php");
    I believe this sends the variable 'myText' to the php file as a variable called 'hsdata' which I want the php file to write into a text file. The mytext variable is just a long string that has all the scores and names in the hiscore. OK, XML would be better way of doing this but for speed I just want to get basic functionality working, so storing a simple text sting is adequate for now. The PHP code that reads the Flash 'hsdata' variable and writes it to the text file 'scores.txt' follows:
    <?php
    //assigns to variable the data POSTed from flash
    $flashdata = $_POST["hsdata"];
    //file handler opens file and erases all contents with w arg
    $fh = fopen("scores.txt","w");
    //adds data to file
    fwrite ($fh,$flashdata);
    //closes file
    fclose ($fh);
    echo 'php file is working';
    ?>
    Any help with this would be greatly appreciated - once I can get php to write simple text files I should be ok. Thanks.

    Thanks for your help.
    I have got Flash working to a certain extent with PHP using loadVars but have been unable to get flash to receive a variable declared in PHP. Here's my Flash code:
    var outLV = new LoadVars();
    var inLV = new LoadVars();
    function sendData() {
    outLV.hsdata = "Hello from Flash";
    outLV.sendAndLoad("http://www.mysite.com/hiscores/test23.php",inLV,"post");
    inLV.onLoad = function(success) {
    if (success) {
      //sets dynamic text box to show variable sent from php
      statusTxt.text = phpmess;
    } else {
      statusTxt.text = "No Data Received";
    This works ok and the inLV.onLoad function reports that it is receiving data but does not display the variable received from PHP. The PHP file is like this:
    <?php
    $mytxt =$_POST['hsdata'];
    $myfile = "test23.txt";
    $fh = fopen($myfile,'w');
    //adds data to file
    fwrite($fh, $mytxt);
    //closes file
    fclose ($fh);
    $mess = "hello there from php";
    echo ("&phpmess=$mess&");
    ?>
    The PHP file is correctly receiving the hsdata from flash and writing it to a text file, but there seems to be a problem with the final part of the code which is intended to send a variable called 'phpmess' back to Flash, this is the string "hello there from php". How do I set up Flash and PHP so that PHP can send a variable back to Flash using echo? Really have tried everything but am totally baffled. Online tutorials have given numerous different syntax configurations for how the PHP file should be written which has really confused me - any help would be greatly appreciated.

  • Making a High Score Table

    Is there a way to check if a cookie(holding the high scores)
    exists and then if it doesnt i can make a list...
    Also, would you advise using an ordinary list or a property
    list for the highscores and in what way would be best for sorting
    the list...
    thank you!!

    check out my posts here:
    http://director-online.com/forums/read.php?2,25525

  • Pinball High Scores Table

    Can I get a table to automatically sort itself, when I enter a score into a row?
    Andy

    Andy Moore wrote:
    Can I get a table to automatically sort itself, when I enter a score into a row?
    NO
    At best, you may build an auxiliary table grabbing datas from the main one thru formulas able to order them.
    Yvan KOENIG (VALLAURIS, France) mercredi 30 septembre 2009 21:16:13

  • High Score Security

    Hi I recently made a game(dosen't really matter what kind) in which the user gets a score and saves the score to my high score table.
    I do this by connecting to a .php page and passing the score and name variables on to it. (www.random.com/blablabla.php?name=bla&score=676) The page then opens the mySQL table and saves the high scores. THe page is opened from within the applet and the user dosen't see the page opening.
    The problem I am having is security, and i'm trying to make it so that nobody can access that php page from their browser and input whatever score they want and what not. THis was brought to my attention by my friend who put images(none rude) and hyperlinks allover my high score page. He was nice enough to tell me so now I am trying to fix it.
    THe first steps I took were to not package the source code with the jar(which he downloaded and extracted). But even then I could decompile the class file and search the file for ".php" and easily know what url to type into the browser to input any score for my game. I then tried using an obfuscator, ProGuard, which didn't help me much. It only renamed all the classes and variables, but the String I open for the high score I still very easily visible. Also from other people I got the general opinion that they(obfuscators) aren't much good as they only make it slightly harder to people to get the information, not make it impossible.
    Basically what I want to do is to make it as hard as possible for people(namely my friend...) to find out the page which saves the high scores, and type it into their browsers so they can input whatever high score they want. Obfusticating didn't help much and now I am running out of ideas. I was thinking about:
    Making sure the thing that oppened the page is an applet, but I'm not sure how to do this. This would be my ideal solution as I am not too worried about people who would go out of their way to make an applet with the same name as mine just to "hack" my high scores which aren't even worth hacking. But how would I go about doing this?

    You could do this using a client/server system comminicating using sockets, rather than simply a HTML request sent from the client. This way the client could be required to provide some validation before the server accepts score updates from it.
    The trick is to decide how the validation is done; you need to be able to differentiate between genuine clients and a client your friend has decompiled and changed so he can cheat.
    Remember that your friend can see exactly how the client works, but cannot see how the server works. Maybe you could send a copy of the client class object to the server and then the server could checksum it?

  • Table without table name

    Is it possible to create a table without table name and retrieve the information from that table?
    Edited by: Kamesh on Sep 20, 2010 11:05 AM

    Kamesh wrote:
    Is it possible to create a table without table name and retrieve the information from that table?
    Edited by: Kamesh on Sep 20, 2010 11:05 AMNo, every table in a schema has to have a unique name. Any string will do.
    If the name does not conform to the standard rules for identifiers (including the rule about no special characters, such as spaces) then the name must be enclosed in double-quotes. As William pointed out, " " (with a single space between the quotes) is a name; it has a length of 1.
    This reminds me of a great story. It's so good, it probably didn't really happen, but it's so good, I'm going to repeat it anyway.
    IBM once had an "executive apptitude test" that they would give to job applicants. There were some questions you might call general knowlege or trivia questions, and each question had a weight (for example, answering an unimportant queestion might score one point, an important question might be 5 points.) One of the questions was "What is the standard width of a mobile home?", and the weight of the question was -20: answering the question correctly did serious harm to your score. The reasoning was that the more you knew about mobile homes, the less likely you were to be their kind of executive.
    I wonder if this was the same kind of trick question.
    I agree with Mtefft; the correct answer is something like "Why would you want to?"

  • Access other schema's table without specify the schema name

    Hi, need ur help again,
    I would like to access other schema's table without specify the schema name. for example,
    select * from hr.jobs;
    What priviledges i need if i want to select the data in this way:
    select * from jobs;
    Thanks!

    Public synonyms have their place, but are not generally a good idea as they will cause conflicts with other schemas and applications. Another think that you can do is issue the
    ALTER SESSION set CURRENT_SCHEMA = schema;
    The CURRENT_SCHEMA (8i and above) parameter changes the current schema of the session to the specified schema. Subsequent nqualified references to schema objects during the session will resolve to objects in the specified schema. The setting persists for the duration of the session or until you issue another ALTER SESSION SET CURRENT_SCHEMA statement. CURRENT_SCHEMA is a session parameter only, not an initialization parameter.
    This setting offers a convenient way to perform operations on objects in a schema other than that of the current user without having to qualify the objects with the schema name. This setting changes the current schema, but it does not change the session user or the current user, nor does it give you any additional system or object privileges for the session.

  • IPhone High Score Data File/Sort Oddities

    Hello all.
    I am working on an iPhone game which is nearly complete but I am having trouble with the following high score sort/write code. I am aiming to keep up to 10 scores, sorted from highest to lowest obviously.
    The code creates a new data file with the current score added as first entry if there is no existing data file (and this works), or it creates a data file with the current score as first entry if a data file exists but is empty for some reason (and this works as well), or it adds the current score to a data file of existing scores if it is within the top ten or there are less than ten entries (this is where it gets odd).
    If there is one existing score in the data file, the current score is added and sorted properly. If there are two scores in the data file, the application crashes BUT the data file shows the current score was correctly added and sorted to the existing scores. If there are three existing scores, the application crashes and the data file remains unchanged.
    I have been over the logic many times and tried many different variations of the logic structure to no avail. I suspect it is something simple but I've been staring at it too long to see. Any ideas?
    If there is a better way to display the code/formatting on the forum, please let me know. It doesn't look pretty this way and there must be a way to make it more readable here. I tried to manually format it some to help. The code follows (score variable is brought in from another class but works properly in my tests). At the end I have repeated an isolated snippet of the code where I think the problem occurs.
    *CODE START:*
    int i, ii;
    struct highscoreentry {
    NSString *name;
    int highScore;
    struct highscoreentry structArray(10);
    FILE *fin = fopen("highscore.dat", "rb");
    if (fin != NULL) { //if the data file exists proceed here
    for (i = 0; i < 10; i++) {
    if (fscanf(fin, "%s %d\n", structArray(i).name, &structArray(i).highScore) != EOF) { //if data exists for this iteration proceed
    ii = i; //ii will be the last entry of existing data
    for (i = ii; i > -1; i--) { //will begin at last entry and work up the list of scores to sort
    if (score > structArray(i).highScore) { //if current score is higher than recoded score, recorded score moves down 1 place
    structArray(i + 1) = structArray(i);
    structArray(i).name = (NSString *)"JESSE";
    structArray(i).highScore = score;
    if (i == ii && ii < 9) //if there are less than 10 entries we will add another for our new entry
    ii = ii + 1;
    else if (score < structArray(i).highScore && i == ii) { //if current score is less than last recorded score it becomes new last entry
    structArray(i + 1).name = (NSString *)"JESSE";
    structArray(i + 1).highScore = score;
    if (ii < 9)
    ii = ii + 1;
    fclose(fin);
    if (fin == NULL) { //if the data file does not exist prepare data for new file
    ii = 0; //will be used to limit write iterations to this single new entry
    structArray(0).name = (NSString *)"JESSE";
    structArray(0).highScore = score;
    FILE *fout;
    fout = fopen("highscore.dat", "wb"); //should create/rewrite data file from scratch
    for (i = 0; i <= ii; i++) {
    fprintf(fout, "%s %d\n", structArray(i).name, structArray(i).highScore);
    fclose(fout);
    *CODE END*
    As far as I can tell by commenting out different portions of the code, the problem appears to be somewhere in here:
    *CODE START:*
    if (fin != NULL) { //if the data file exists proceed here
    for (i = 0; i < 10; i++) {
    if (fscanf(fin, "%s %d\n", structArray(i).name, &structArray(i).highScore) != EOF) { //if data exists for this iteration proceed
    *CODE END*
    ...but it baffles me that this works with one structure in the data file, crashes with two structures in the data file but correctly processes/sorts them and writes the file properly, and crashes with three structures in the data file without doing any additional work.
    Jesse Widener
    www.artandstructure.com

    Actually I've found online material to be adequately, and sometimes more than adequately, elucidating in learning the language. When I decided to take a stab at this I spent about 40 hours of my spare time the first week reading 2 or 3 different "takes" on the C/C++/Objective C language in addition to Apple's docs on their implementation along with the iPhone SDK. As I mentioned, I've thus far found the language quite clear and concise. I began my application the second week and this is the first time in 7 weeks of coding where I've felt the need to ask assistance. Every other problem I've solved, leaving no errors, warnings or leaks in my software and accomplishing every task I've set to this point.
    I find reading several different "takes" on a subject helps fill out an understanding from different perspectives. In this case, one perspective might lead the reader to believe or misunderstand the full use/context of a particular syntax, while reading from multiple sources can show the same syntax used in different contexts, broadening the understanding of its use, and that understanding can be user further to interpolate uses in a variety of situations.
    I am new to C/C++/Objective C and the iPhone SDK, but I am not new to programming. It may have been some time (other than hand-coding my website the last few years) and my language experience may be limited to BASIC, HTML, PHP and Javascript, but from my view learning a new language is relatively easy once you know one...even if it is BASIC. The general logic structure remains the same. The overall software design concept remans essentially the same. Both are going to use variables, arrays, subroutines, memory allocation/management, input and output of data, runtime logic, etc. I am 80-90% sure I know exactly how I want to attack a coding problem every time...I just need to know how to "say it in C".
    I don't remember when I first started coding, but I know by age 7 I wrote a karaoke style "Happy Birthday" for my great aunt with music playing through a Commodore 16 via "beeps" figuring the particular vibrations per second of the speaker (the hertz values) and durations for each note in time and pitch perfectly along with "lyrics" printed to screen with the music. To me, learning C is like learning a new foreign language. I took 2 years of French in high school and had to study at it but aced it nonetheless. I then opted to take Spanish but after a semester I opted to stop because the pacing was too slow. Learning Spanish after learning French was a piece of cake. They are in the same general language family and the syntax construction is very similar. I only needed the raw data of the words to fit to the rules I already knew. I didn't need to learn the same rules a second time.
    The C/Objective C language seems no more complicated than it need be, which is to say it seems simple in doing what it needs to do and I am impressed with that simplicity thus far. I am also impressed with Apple's implementation with regard to the iPhone. Being able to provide music via 4-5 lines of code using AVAudioPlayer is transcendental compared to "beeping" every note monophonically.
    Apple's explanations are very clear and concise. It is just, sometimes their examples are sparse or too narrow in scope to get a rounded context. However, their docs are very good and there is a wealth of information here on the net. My biggest complaint with Apple's docs really stems from the fact they seem to want to shove Interface Builder at everything and provide the code to do so but leave the reader stranded if the reader would rather stay within XCode exclusively and do more programmatically rather than leave that much "behind the curtain" work to Interface Builder...but it is a minor complaint.
    On pointers...I do understand the use of pointers, perhaps not to the nth degree as I am just starting out, but the concept makes sense to me. I understand they are not "content" but a memory address location of the "content". I also understand why pointing to a location which is undefined or unprotected is damaging to whatever may be in that location already and to the data being pointed since it can be inadvertently overwritten my some other memory using item.
    {quote}No. The (i < 9) condition is critical. Writing to structArray[10] will crash, since structArray[9] is the end of the array. In practice such a crash might not happen right away, though. If our program's data allocation actually ended at the end of the array, the crash would be immediate. But what usually happens when we write past the end of an array is that the beginning of some other data is overwritten.{quote}
    I need to slap my forehead on this one. I know better than that. I don't know why I missed that. Too many late nights I suppose.
    {quote}(NSString*) is called a type cast in that context.{quote}
    Yes, which is why I used it to deal with the incompatible type error I thought I had at that point, but I shouldn't have assumed by appeasing the compiler I was necessarily solving the problem.
    {quote} The best I can do for now is to caution that an enquiring mind, like all virtues, can be taken too far. I think it's important to compromise and copy good models sometimes. This isn't just to avoid reinventing the wheel. Sometimes it's good to remember we only have a limited time on Earth.{quote}
    Agreed...and I don't expect to understand every nuance the first time around. I expect to at least understand how each successful line of code works in its context, but I imagine some processes will take a few times through before it "clicks" how it works in a greater context than its own, and I am all right with that. I also understand deadlines are deadlines whether they be software development or otherwise and a broad eye needs to be kept to remaining on the track forward.
    Anyway, off to my day job.
    Thank you again...I began reading up on NSDictionary and NSUserDefaults last night. Will post soon.
    Jesse Widener
    www.artandstructure.com

  • Add / Delete a row in a table without using a button

    Hi,
    I was just wondering if it was possible to remove or add a row in a table without using the button?  I noticed that in all examples, it always involve putting code in the button click event but I wanted to add or delete a row in a table based on the fact if the row contains a certain value or not.  Is that possible?
    Much appreciated,
    Vincent

    Vincent,
         Here is the updated file..
    https://acrobat.com/#d=bVDBNM0pnS2IpfE58V01Tg
    You have checked the checkbox "Repeat subform for each Row" for Header Row under IndTable1. You need to do at Row1 level of Table1.
    I bound the Row1 of Table1 to <Row1> tag in your XML which can repeat multiple times.
    I wrote the code in the Doc Ready event of the Test1 field to check whether the value is existing or not. If it does not have a value, then I am removing the instance of the Row1 by passing the current index.. (You can check the code)..
    While creating a data connection using XML you need to make sure that the below structure is repeated atleast 2 times. And while previewing you can use make a copy of this same XML and remove Row1.
      <Row1>
        <Test1>Individual Name 1</Test1>
      </Row1>
    Thanks
    Srini

  • How to manage high score file

    Hello,
    I have made i little game in CVI, in the end of the game user get a score base on the levels he passed and the level of difficulty.
    As this is a school assignment i have to have a score board. I've made score board using a table and i read arguments from a txt file.
    All I read is the name of the player and his score.
    The trouble that I'm having is to check the txt file and see if the new score of the user can be put in the score board.
    I need to known how I check if user's new score need to be put into the score txt file, and how to put it there.
    Thanks in advacne!

    Hello Slavik87!
    If I understand your question correctly, want to are asking is how to read the text file, retrieve the highest scores from it and update the file again.
    If you are asking about which functions to use, these are some functions you can use to perform the file operations:
    fopen, to open the file
    fputs, to write a string to the file
    fgets, to get a string from the file
    fseek, to navigate through the file
    fclose, to close the file
    Here are some suggestions about how you can manage the information in your text file:
    Insert each new entry (name, score) on a separate new row, optionally using separators:
    John Doe, 10
    Kelly Smith, 43
    Kevin Brown, 4
    After reading these lines from disk, you would have to store the entries in some data structures (e.g. lists, structures) for your application to manage.
    For optimization, you can also sort the rows based on the highest score, this way, when you want to retrieve the highest scores, these are already situated at the beginning of the file. However, when you update the rows, you would have to switch places of rows, when a person will have a higher score than the previous item(s).
    Best regards!
    - Johannes

  • How to add the rows formatted as table headings, Tables headings are repeated when a table spans more than one page.

    Hi all,
    i am facing problem while generating Test Result word document after successful execution of TestStand.
    The Problem is :
    i want to add rows Formatted as table headings, table headings are repeated when a table spans more than one page(marked as Red).
    Example:
    Page  No. 1
    |     Test case Number  |  Test Step number      |
    |      100                         |            100                   |
    Page  No. 2
    |     Test case Number  |  Test Step number      |
    |      200                         |            300                   |
    Test Result word document should generate with Table headings(marked as Red) in every pages of the document, but i am not getting as per above example.
    Please through light on this.
    Regards,
    Susa.

    Hi Santiago,
    Thank you very much for your valuable reply.
    i want to generate MS-word report for TestStand after successful testing using MS-word2000.
    Test report contains Actual values, Expected values and Pass/Fail status.
    In my program i have customized all  fields i can able to generate test report which contains Verification engineer name , test mode, test date, start time, end time Actual values, Expected values and Pass/Fail status.etc....
    To put all values of test case number, Test step number, Actual values, Expected values and Pass/Fail status in to table for each time, i will
    insert a row into table every time values arrives, once the table exceedes its page size it moves to the next page, next page should start with table row header  but it start with  values of above said parameters.
    so i'm not able to repeat table row header for each page.
    Please find the attached file for your reference.
    Attched file expected.doc  :   This file contains what i wanted to generate MS-word report. Here table row header "Test Case Number and Test Step Number " is repeated in second page.
    Attached file Actual output from source code.doc   :  This report generated from the source code. Here table row header "Test Case Number and Test Step Number" is not repeated in second page.
    Do you know any property to set "repeat as header row at the top of each page" using MS-word ActiveX in CVI/Labwindows.
    i think this information is sufficient for you,
    Still if you need some information please ask me.
    Thanks
    Susa.
    Attachments:
    Actual output from source code.doc ‏25 KB
    expected.doc ‏26 KB

  • Adding a single table without a logical join to another table (OBIEE 10g)

    Sometimes I want to just display a single table without a logical join to another table in the repository. However, everytime I move it to the Business Model and Mapping layer and perform a Global Consistency Check, it tells me that it needs a logical join and I am forced to create another table to join to it. Thus creating a dimension-fact relationship. There are times I don't need this relationship and just want to display some data. Is there anyway to get around this?
    Thanks in advance!

    Yes,You have to create a join.You cannot take single table to BMM layer.You can create an alias of the table.Join this alias and base table through any common column and take both tables to BMM and desired table to presentation layer.
    Another way is to create a view in physcial layer.Write a select statement like
    Select primary_key from Table
    Where primary_key is primary key of base table.Join this view ith base table and repeat the steps defined for Alias.
    Regards,
    Sandeep

  • I need the "Real" Table / Table Column names from a sql view

    Firstly, we have a system with ~1000 tables and ~250 views.  We have field level security on the table columns (in our code)
    Now we have a lot of views which select data from the tables, but I need to get the "Table Column Name" that is linked in the view. 
    I know there are view columns that is not linked to a specific table column, (or concatenation of columns) so those columns can just return NULL.
    From the sample you will see there is a view selecting data from another view.  I know it is not the best sql performance (execution path) but that is another topic on its own.
    I went through a lot of the sys.* stored procs or sys.* views to try and figure out if there is a view that we can use to get the expected results.
    here is the sql code:
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'AliasView2')
    drop view dbo.AliasView2
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'AliasView1')
    drop view dbo.AliasView1
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'Table4')
    BEGIN
    alter table dbo.Table4
    DROP CONSTRAINT [FK_T4_T3]
    alter table dbo.Table4
    DROP CONSTRAINT [PK_T4_Constraint]
    drop table dbo.Table4
    END
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'Table3')
    BEGIN
    alter table dbo.Table3
    DROP CONSTRAINT [FK_T3_T2]
    alter table dbo.Table3
    DROP CONSTRAINT [PK_T3_Constraint]
    drop table dbo.Table3
    END
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'Table2')
    BEGIN
    alter table dbo.Table2
    DROP CONSTRAINT [FK_T2_T1]
    alter table dbo.Table2
    DROP CONSTRAINT [PK_T2_Constraint]
    drop table dbo.Table2
    END
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'Table1')
    BEGIN
    alter table dbo.Table1
    DROP CONSTRAINT [PK_T1_Constraint]
    drop table dbo.Table1
    END
    create
    Table dbo.Table1
    T1_PK        int
    NOT NULL
    Identity(1, 1)
    CONSTRAINT [PK_T1_Constraint]
    PRIMARY KEY (T1_PK),
    T1_Field1    varchar
    NULL,
    T1_Field2    varchar
    NULL,
    create
    Table dbo.Table2
    T2_PK        int
    NOT NULL
    Identity(1, 1)
    CONSTRAINT [PK_T2_Constraint]
    PRIMARY KEY (T2_PK),
    T2_Field1    varchar
    NULL,
    T2_Field2    varchar
    NULL,
    T2_FK        int
    NOT NULL
    CONSTRAINT [FK_T2_T1]
    FOREIGN KEY (T2_FK)
    REFERENCES dbo.Table1
    (T1_PK)
    create
    Table dbo.Table3
    T3_PK        int
    NOT NULL
    Identity(1, 1)
    CONSTRAINT [PK_T3_Constraint]
    PRIMARY KEY (T3_PK),
    T3_Field1    varchar
    NULL,
    T3_Field2    varchar
    NULL,
    T3_FK        int
    NOT NULL
    CONSTRAINT [FK_T3_T2]
    FOREIGN KEY (T3_FK)
    REFERENCES dbo.Table2
    (T2_PK)
    create
    Table dbo.Table4
    T4_PK        int
    NOT NULL
    Identity(1, 1)
    CONSTRAINT [PK_T4_Constraint]
    PRIMARY KEY (T4_PK),
    T4_Field1    varchar
    NULL,
    T4_Field2    varchar
    NULL,
    T4_FK        int
    NOT NULL
    CONSTRAINT [FK_T4_T3]
    FOREIGN KEY (T4_FK)
    REFERENCES dbo.Table3
    (T3_PK)
    GO
    --Create a basic view to select some data
    CREATE
    VIEW dbo.AliasView1
    AS
    select
    t2.T2_FK as Table2_ForeignKey,
    t1.T1_Field1 as Table1_FieldOne,
    t2.T2_Field1 as Table2_FieldOne
    FROM Table1 t1
    Left outer
    join Table2 t2 on t2.T2_FK
    = t1.T1_PK;
    GO
    --Create another view that select basic data, and also selecting data from view 1
    CREATE
    VIEW dbo.AliasView2
    AS
    select
    v1.Table1_FieldOne
    as Table1_FieldOne,     
    v1.Table2_FieldOne
    as Table2_FieldOne,  
    t3.T3_Field1 as Table3_FieldOne,
    t3.T3_Field2 
    FROM Table3 t3
    Left outer
    join AliasView1 v1 on v1.Table2_ForeignKey
    = t3.T3_PK;
    GO
    --My attempt to get the desired output, but no luck
    SELECT 
    col.COLUMN_NAME as AliasColumnName, col.DATA_TYPE, col.CHARACTER_MAXIMUM_LENGTH
    as max_length, colu.*
    FROM
    information_schema.COLUMNS col
    left
    outer join
    (SELECT 
    VIEW_SCHEMA, VIEW_NAME, COLUMN_NAME,
    min(TABLE_NAME)
    as TABLE_NAME
    FROM information_schema.VIEW_COLUMN_USAGE colu
    WHERE VIEW_NAME =
    'AliasView2'
    Group by VIEW_SCHEMA, VIEW_NAME, COLUMN_NAME
    ) COLU ON colU.VIEW_NAME
    = col.TABLE_NAME
    and colu.COLUMN_NAME
    = col.COLUMN_NAME
    left
    outer join
    (select a.name
    as TableName, c.name
    as FieldName
    from sys.foreign_key_columns fk
    join sys.all_objects a
    on a.object_id
    = fk.parent_object_id
    join sys.all_columns c
    on c.object_id
    = a.object_id
    and c.column_id
    = fk.parent_column_id
    join sys.all_objects ar
    on ar.object_id
    = fk.referenced_object_id
    join sys.all_columns cr
    on cr.object_id
    = ar.object_id
    and cr.column_id
    = fk.referenced_column_id
    join sys.schemas scr
    on scr.schema_id
    = ar.schema_id
    ) fks on fks.TableName
    = colu.TABLE_NAME
    and fks.FieldName
    = colu.COLUMN_NAME
    WHERE COL.TABLE_NAME
    = 'AliasView2'
    order
    by col.ORDINAL_POSITION
    This is the results being returned: (That is not 100% what I am looking for)
    AliasColumnName
    DATA_TYPE
    max_length
    VIEW_SCHEMA
    VIEW_NAME
    COLUMN_NAME
    TABLE_NAME
    Table1_FieldOne
    varchar
    1
    dbo
    AliasView2
    Table1_FieldOne
    AliasView1
    Table2_FieldOne
    varchar
    1
    dbo
    AliasView2
    Table2_FieldOne
    AliasView1
    Table3_FieldOne
    varchar
    1
    NULL
    NULL
    NULL
    NULL
    T3_Field2
    varchar
    1
    dbo
    AliasView2
    T3_Field2
    Table3
    The desired results must be like the following:
    AliasColumnName
    DATA_TYPE
    max_length
    VIEW_SCHEMA
    VIEW_NAME
    COLUMN_NAME
    TABLE_NAME
    Table1_FieldOne
    varchar
    1
    dbo
    AliasView2
    T1_Field1
    Table1
    Table2_FieldOne
    varchar
    1
    dbo
    AliasView2
    T2_Field1
    Table2
    Table3_FieldOne
    varchar
    1
    dbo
    AliasView2
    T3_Field1
    Table3
    T3_Field2
    varchar
    1
    dbo
    AliasView2
    T3_Field2
    Table3
    NOTE:  the COLUMN_NAME and TABLE_NAME must the REAL field of the TABLE it belongs to and not only ONE LEVEL Higher’s ALIAS View Name

    Now we have a lot of views which select data from the tables, but I need to get the "Table Column Name" that is linked in the view.
    If you are using SQL Server 2012/2014, then you can use
    sys.dm_exec_describe_first_result_set (Transact-SQL) to gte the informations.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How to modify  a table without  setting system to modifiable

    Hi All
    Is there a way to modify a table without setting the system to modifiable either in SCC4 or SE06.
    We locked SCC4 in our system , however one tables are not able to modify.
    table name YAUTM
    Is there a way to bypass this?
    Edited by: Shou Woon Wee on Jan 11, 2008 3:09 AM

    Hi Shou......
    if it gives you a message....."the client is not modifiable"/ ALIAS "table not modifiable"  ...then from a security perspective....you cant, and you might not want to bypass it!
    SCC4 settings are meant to be for that!  Contact your Basis team for this.
    The only way to bypass this is thru ....sending changes through a transport request.
    Curiosity: what environment are you trying this out ? cant be sandbox or DEV!
    Regards
    Abhishek

  • Flash Game High Scores Board

    Hello everyone,
    I know this is a subject that gets covered a lot as i have found a ton of tutorials that show a million dfferent ways to create a high scores board on a flash game.  So i decided to go out on a limb and pick a tutorial out to try.  Well I have now tried 3 different ones and have yet to get a working high scores board with my game.
    http://www.flashkit.com/tutorials/Games/How_to_c-Nick_Kuh-771/index.php
    That is the link to the most recent attempts to creat my high scores board.  When i finished everything the way the tutorial said it seemed like everything would work and then it just didnt.  After spending oh about 40 plus hours trying to make a high scores board i am getting very frustrated.  My game is scripted in AS2 and i have access to mysql and can set up unlimited databases.
    Can anyone please help me by sending an easy to follow tutorial that will work with AS2?  I would just like any kind of help right now as I feel ALL of my valid ideas have been ehausted.  Thanks in advance to anyone that can help!
    kapelskic

    Okay not a problem.
    This is my code on the very first frame of the game that initializes the the highscores.php script
    command = "init";
    _root.loadVariables("highscores.php?"+int(Math.random()*100000), "POST");
    This is the code that I have on a submit button, next to the input text box where the user enters their name for the scoreboard.
    on (release) {
    if(name ne ""){
    command = "update";
    _root.loadVariables("highscores.php?"+int(Math.random()*100000), "POST");
    gotoAndStop ("highScores");
    In every place the code says _root. I have also tried this. and neither of them work.  I have also tried a million other things.  So far the game plays through, goes to the game over screen where it asks for a user name and tells them their score.  Then once they press submit the game goes to the highScores screen but the name and score are not there.  The high scores screen cosists of 2 dynamic text fields one named "players" and one named "scores".  I hope this helps because I spent another 5 or so hours after my initial posts trying more tutorials with still no luck.  (the problem i am having is that i am new to flash, however not to PHP)
    kapelskic

Maybe you are looking for

  • Hyperlinking text in form fields

    I'm using Acrobat 9 Pro and filling out a form that was supplied to me in PDF format. I don't say anyway to hyperlink words (in form fields) in Acrobat Pro. Is it not possible?

  • Identifying and managing clients in nonblocking NIO socket programming

    Here's my beef. When I write a Server using a thread for every new connection that comes in, I can remember everything for each client in its respective thread. I can have a table entry in a MYSQL database for each client which each thread can look u

  • How to run servlet from JSP page

    A simple JSP page,where I will put a button.And on clicking..it will invoke the servlet and the servlet will send the result to the jsp page... Please give the instructions with examples... Thanks in advance...

  • Apple Mail search feature?

    Is there a concise list anyplace that explains how to do boolean searches in Apple Mail, and all the various options? Have found information scattered here & there, and help file offers general instructions but no information on how to actually make

  • Can't find my rental in itunes 11.0.1

    I just rented Ted.  The first movie I rented in the new itunes 11.0.1.  Never had any problems before, but it does not show up in my movies.  I can't even find a tab for rentals anywhere in 11.  Anyone else have this issue?