Is there something similar as EVALUATE(Field1)?

[quote=312929:@Neil Burkholder]@Michel Bujardet

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.

I believe it should be possible to emulate closely what is described at
https://msdn.microsoft.com/en-us/library/office/aa223886(v=office.11).aspx

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.

Unless Alvin says what he wants we can only guess. While your probably right about the Evaluate method it’s still only a guess.

https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate

Then at this point, we should stop speculating, and wait for Alvin to say exactly which function should be emulated.

We should have started by that actually.

[quote=312931:@Michel Bujardet]Then the get value could be wrapped in a method that tests the existence of the key.

I believe it should be possible to emulate closely what is described at
https://msdn.microsoft.com/en-us/library/office/aa223886(v=office.11).aspx

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.

In visual foxpro, i am able to accomplish this

Field1 = “apple”
InputString = “Field1”
cResult = EVALUATE(InputString)
? cResult && returns apple

I am trying to interpret a string as a code or variable

There is no direct equivalent
You’ll have to write some code to achieve this or something like it

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=312934:@Alvin Lim]Sorry maybe i really cannot express my questions clearly.

In visual foxpro, i am able to accomplish this[/quote]

Please be so kind to link to the Visual FoxPro documentation for that method. That is the only way we are going to see exactly what you are after.

I am sorry, but indeed your explanations are in practice unusable, at least for me.

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

[quote=312934:@Alvin Lim]Field1 = “apple”
InputString = “Field1”
cResult = EVALUATE(InputString)
? cResult && returns apple[/quote]

What is this supposed to do ? ? ?

? cResult && returns apple

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.”

How is it being input and stored?

What is clearly thought out is clearly expressed

All that is so unclear, I suspect Alvin does not quite grasp what he wants to do.

For instance this

InputString = "Field1" cResult = EVALUATE(InputString)

Would be a lot simpler as

InputString = "Field1" cResult = InputString

Until Alvin links to the FoxPro manual page and writes clear code he uses in Foxpro, I am out of here.

The example web app I posted does exactly that. Well almost. It puts the output into a listbox instead of a msgbox.

MsgBox Field1+" "+Field2+" "+Field3

Or, you wrap that into a method that concatenates the strings and call it Evaluate if you feel more comfortable with it.

Seems to me you are not putting enough efforts in thinking the Xojo 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.

Here is an example project to show you.
dict.xojo_binary_project

[quote=312945:@Michel Bujardet]What is this supposed to do ? ? ?

? cResult && returns apple

? The question mark is the display command.

https://technet.microsoft.com/en-us/library/aa977640(v=vs.71).aspx

[quote=312962:@Alvin Lim]? The question mark is the display command.

https://technet.microsoft.com/en-us/library/aa977640(v=vs.71).aspx[/quote]

See, that is exactly what I meant. Please make the effort to use Xojo. If you stay stuck in another language, you will not make progress.

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. :slight_smile: