That will cause a keynotfound exception if the value is not first set. I already gave him a similar answer and the response was: @Alvin Lim In actual fact, Field1 does not exist at all… I do not know what should be placed in the Question mark. (To set the value of field1)[/quote]
Then the get value could be wrapped in a method that tests the existence of the key.
At any rate I cannot shake a strong feeling that Alvin is not quite sure about what he wants.
His reply about the key not existing make me think he does not even a grasp of his program structure. Even with Evaluate() as described by Microsoft, the programmer is supposed to know when he sets the expression.
Reason why instead of asking about a pink elephant, I went for the documentation. Strangely enough, nobody before tried to see what Evaluate() was supposed to actually do.
At any rate I cannot shake a strong feeling that Alvin is not quite sure about what he wants.
His reply about the key not existing make me think he does not even a grasp of his program structure. Even with Evaluate() as described by Microsoft, the programmer is supposed to know when he sets the expression.
Reason why instead of asking about a pink elephant, I went for the documentation. Strangely enough, nobody before tried to see what Evaluate() was supposed to actually do.[/quote]
Sorry maybe i really cannot express my questions clearly.
Not without bending over backwards.
It would be easier to reevaluate your approach and use a Dictionary.
Why don’t you tell us what you’re really trying to accomplish, the functionality you want the user to experience. Maybe we can point you in the proper direction for implementation of what you want.
I find people tend to get better answers when they’re direct with what they want to do instead of trying to mask and hide it in what they think is a pared-down basic version. So give us a “I want my user to be able to do _________.” explanation instead of trying to come up with a backend.
I’m not familiar with FoxPro but Ruby has an eval method. I never had to use eval in all my ruby programing. In Xojo there is no equivalent. You can achieve the end results you need without it. See this discussion on stack overflow. http://stackoverflow.com/questions/1902744/when-is-eval-in-ruby-justified
I assumed the fourth line was a comment. The rest of it reads like when people ask about getting a variable value into another variable from it’s name.
Back from my meetings and I agree with all: At the point, I can’t visualize what the problem is that we’re trying to solve.
If the users are going to enter the data at runtime, how are they doing it and how are you storing it? We’ve gone through almost a dozen ways to indirectly retrieve data programmatically only to be told that “The data isn’t being stored that way.”
[quote=312938:@Tim Parnell]Not without bending over backwards.
It would be easier to reevaluate your approach and use a Dictionary.
Why don’t you tell us what you’re really trying to accomplish, the functionality you want the user to experience. Maybe we can point you in the proper direction for implementation of what you want.
I find people tend to get better answers when they’re direct with what they want to do instead of trying to mask and hide it in what they think is a pared-down basic version. So give us a “I want my user to be able to do _________.” explanation instead of trying to come up with a backend.[/quote]
Assuming these are the initial values:-
Field1 = “Apple”
Field2 = “Strawberry”
Field3 = “Orange”
Field4 = “Pear”
Field5 = “Mango”
Values will change within times. Please take note that Field1 to Field5 are not controls.
User will input a string, lets say “Field1, Field3, Field5”
I am intending to write a function call EVALUATE to process the 3 Fields
MsgBox EVALUATE(“Field1, Field3, Field5”) // it will returns “Apple Orange Mango”
Yeah, a Dictionary with Lookup should be enough to return Apple Orange Mango.
If you want something that works for your specific case, we’re going to need more details about your specific case.
Ok guys and mentors, thanks for all the comments and suggestions. I sincerely appreciate all your preciously time spending on my thread. I will call it a day.