Announcement

Collapse
No announcement yet.

Getting specific data from a file.....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting specific data from a file.....

    I have a text file,(but can be any format) that I would like to be able to pull specific information from. Example...box one has a list of 50 states. when a state is selected, box2 lists the major cities from the selected state. when a city is selected, box3 give a list of local prefixes for the city selected.

    Any body have any suggestions?

  • #2
    Re: Getting specific data from a file.....

    The discussion in this other thread might help you...

    You could also have a look at the attached example (also from that thread).

    12371-Raceday.zip
    --[[ Indigo Rose Software Developer ]]

    Comment


    • #3
      Re: Getting specific data from a file.....

      Ok, the example has helped me out tremendously. Thank you.
      I have one more question though, Can I have the data shown in the box3 list something like this "555-555-5555 N3" but when selected it adds just the "555-555-5555" to an INI file, leaving the N3 out?

      Comment


      • #4
        Re: Getting specific data from a file.....

        Sure! There are a few different ways to approach that, actually. You could use some String actions to trim off the N3 part before you display it...or (and this is probably the best way) you could just store the alternate text as the hidden "data" part of that item.

        See the "Adding an item to a list box (with data)" action example in the Command Reference, or search this forum as our own sophisticated and suave Adam put up a really excellent example of this sort of thing at one point.
        --[[ Indigo Rose Software Developer ]]

        Comment


        • #5
          Re: Getting specific data from a file.....

          Ok. I am still having difficulty achieving my goal. I have modified the example "raceday" to better show my dilema.

          If you download the example, you will notice I have added an editbox, and edited the .txt file. If you click on the first date, the first race, you will see a number infront of each horse. What I would like, is for only the horse to be listed in the editbox, not the number and the horse.

          Please check it out, and let me know if you have any help.
          Any questions, you can email me at [email protected]

          I have attached the example file for dowload, or, you can download it from http://www.ejourney.com/~jcobb/raceday_modified.zip

          Thanks again

          12513-raceday_modified.zip

          Comment


          • #6
            Re: Getting specific data from a file.....

            Hi jcobb - taking into account that there may not always be a single digit as the number and there are two spaces (as in this case) between the number and the Horse name, use this method:

            <font color=green>
            <IR_ACTIONS_LIST>
            <Action name="Get Item Text">
            <Type>117</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <TargetListBox>Horses</TargetListBox>
            <GetType>0</GetType>
            <Index/>
            <IndexDelimiter>;;</IndexDelimiter>
            <Variable>%ItemText%</Variable>
            <VarDelimiter>:</VarDelimiter>
            </Action>
            <Action name="Find">
            <Type>21</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%FoundPos%</Variable>
            <SearchIn>%ItemText%</SearchIn>
            <SearchFor> </SearchFor>
            <StartAtPosition>0</StartAtPosition>
            <SearchDirection>0</SearchDirection>
            <CaseSensitive>0</CaseSensitive>
            </Action>
            <Action name="Set Value">
            <Type>6</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%CustomVar%</Variable>
            <Value>%FoundPos% + 2</Value>
            <Evaluate>1</Evaluate>
            </Action>
            <Action name="Mid">
            <Type>24</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%SubString%</Variable>
            <SourceString>%ItemText%</SourceString>
            <StartAtPosition>%CustomVar%</StartAtPosition>
            <NumberOfCharacters>1000</NumberOfCharacters>
            </Action>
            <Action name="Set Text">
            <Type>77</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <ObjectName>EditField1</ObjectName>
            <Text>%SubString%</Text>
            </Action>
            </IR_ACTIONS_LIST>

            </font color=green>
            -
            = Derek
            ["All glory comes from daring to begin" - fortune cookie]

            Comment


            • #7
              Re: Getting specific data from a file.....

              ok...worked perfectly...but I would also need one that would take the beginning data then have 2 spaces then a two characters ie. Horse Name A1 or Horse Name C2. Is this a simple edit to the script above, or a totally new one? I will be playing with it myself, so I will post if I get it.

              Thanks again, for all of your help.

              Comment


              • #8
                Re: Getting specific data from a file.....

                If the txt file format stays the same but 'N3' is added as a suffix, you need to do nothing but add it, in the txt file. The Actions in AMS are reading upto 10000 chars. - so basically to the end of the line, to include anything it finds.

                If you plan on taking out the 'line number' and spaces at the beginning of the line, then an adjustment will be needed.

                -
                = Derek
                ["All glory comes from daring to begin" - fortune cookie]

                Comment


                • #9
                  Re: Getting specific data from a file.....

                  That brings up a question I have, I see that some of the scripts have had the 1000 characters listed in them. Does this reference 1000 characters or until the end of the line? Like the following example with String.Mid, there is an area for number of characters to capture. 1000 characters can be a lot I assume that is will do upto that number of characters or until the end of the line or line break. I did not find the answer in the Command Reference section of the help guide.

                  <IR_ACTIONS_LIST>
                  <Action name="Mid">
                  <Type>24</Type>
                  <Function>0</Function>
                  <DTIndentLevel>0</DTIndentLevel>
                  <Enabled>1</Enabled>
                  <ErrorHandling>
                  <UserNotificationMode>2</UserNotificationMode>
                  <CustomErrorMessage/>
                  <OnErrorAction>0</OnErrorAction>
                  <JumpToLabel/>
                  </ErrorHandling>
                  <Variable>%FileText%</Variable>
                  <SourceString>%FileText%</SourceString>
                  <StartAtPosition>%FoundPos%</StartAtPosition>
                  <NumberOfCharacters>1000000</NumberOfCharacters>
                  </Action>
                  </IR_ACTIONS_LIST>
                  TJ-Tigger
                  "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                  "Draco dormiens nunquam titillandus."
                  Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

                  Comment


                  • #10
                    Re: Getting specific data from a file.....

                    If 1000 chars. is specified, that's what it will look for, whether that is the end of the line or not. If the end of the line is reached before 1000 chars. it will stop at the end of the line.
                    -
                    = Derek
                    ["All glory comes from daring to begin" - fortune cookie]

                    Comment

                    Working...
                    X