PowerBuilder 7 retrieval argument declaration - powerbuilder

I'd like to know how and where I should declare the variable that will be passed to the SQL query. I have already declared it here:
I can't seem to properly declare it in the window part. I have already tried declaring it based on the available samples on the existing system.
p.s. arg_enccode is now declared globally
It's kind of working now, but i still get this message
even though the variable that passed was received by the MySQL Query and my intended results came out. I've already tried renaming the arguments and variables to maybe match things up, but still to no avail.
Is there something I missed?

There doesn’t need to be a naming link between the argument declaration and what’s in the script. Think of it like passing a value to a function (because that’s exactly what’s going on). You could either pass a hard coded value
dw_1.Retrieve (“doctors_orders”)
or you can pass the contents of a variable
string ls_ValueForDW
ls_ValueForDw = “doctors_orders”
dw_1.Retrieve (ls_ValueForDW)
Anticipating the next step, I’d advise capturing the integer return of Retrieve() into a variable so you can at least see it in the debugger.
Good luck.


C++ function-like value pass

first, sorry for the title but I really don´t know ho to summarize what I want to do. I am trying to write very simple "graphic" console game, just to learn basics of C++ and programming generally. When I have a function, I can pass value, or variable into that function while calling it. But I would like to do the same thing to the piece of code, but without using function. Becouse when function is called, program must actually jump to function, than return. So I thought, it would be more CPU-saving to just have that function built-in main, and just somehow select what that code should process. This could be done by passing value I want to process to some extra variable and let that "function" process that variable, but since I work with 2 dimensional fields, I need to use 2 for cycles to actually copy user-selected field to my work field. So what I want to know is, is there some way to do this more efficient? Again, please sorry my english, it´s hard to describe something in a language you don´t speak everyday.
You just described inline functions (including the function when used rather than jump and return) and references (use the caller's variables rather than copy into the function).
Inline functions just happen automatically when you turn the optimizer on, conditions permitting. Not something to worry about.
References are something you should read about in whatever book you are using to learn C++. They are declared like int foo( int &callers_var ); and can capture things like a field in a matrix.
As Roger said, never optimize until you have a functional program and can verify what is slow. That is the first rule of optimization.
Inline functions are the normal way to allow the compiler to avoid the overhead of a function call. However, it sounds like premature optimization here, and your efforts would be better spent elsewhere. A code example may help clarify what you want.

MFC SetRegistryKey… Is there a GetRegistryKey function?

I have these two lines of code.
CString strHost = AfxGetApp()->GetProfileString(_T("WebServices"), _T("Server"));
Nowhere in the app do I set the value. (the installer does that). So the strHost, should be the same no matter where or when this line is run.
Here's what I've got.
Press A -> run function that contains code -> see expected data;
Press B -> do some windows callbacks -> run function that contains code -> see "";
I'd think something in B was clearing the value, but if I press B first and then A, A yeilds what I want not the "".
Sadly I don't have access to the code that holds the windows callbacks, or rather it has got to be the biggest pile of badly managed obfiscation I've ever seen.
What I'm currious about is, if the GetProfileString is pulling the data from somewhere it shouldn't be? It's the only thing I can think of.
1.) Is there a way to confirm I'm still working with the same "key"?
2.) Has anyone ever encountered this before?
Please if you think this is a bad question, and wish to mark it as such, leave a comment so I can fix it.
Though I didn't find the answer fully I did track down something interesting.
I'm using AfxGetApp()->GetProfileString.. It seems the function AfxGetApp() is returning different things at different times.. I'm not sure how that could happen, but at least I can now account for it.
GetProfileString() can also read from a .ini file, besides the registry. If the call to GetProfileString() is done on a different CWinApp-derived object than the one in the main application (in a dll for example), it might try to read from the application's .ini file. Try stepping into GetProfileString() to find out what's going on.
However my advcie is: don't use GetProfileString(). Use CRegKey to directly query the registry. This is probably not what you want to hear because it's a major to have to pass the registry key around. What I usually do is #define a global APPLICATION_REG_KEY macro in stdafx.h. It upsets the purists but it's very convenient.
I found the answer.. Sort of.
The AfxGetApp function returns different objects depending on where it's called.. If it's called in a dll, for instance, it returns a pointer to that. I think it even returns the wrong thing when the app is using the OS calls. This means the GetProfileString is for a different "profile".
I didn't find anyone who'd encountered this, but I consider the issue resolved. Feel free to add more "answers" if you don't..

what's the difference between “change” and “migrate” variable type?

after much googling and only finding some info on migrating I'm still unsure which to choose when presented with what Android prompts me with to fix a type mismatch. I've done both and can't tell if it matters which I choose. Are they in fact the same?
Type Migration
The Type Migration refactoring allows you to automatically change a member type (e.g. from integer to string), and data flow dependent type entries, like method return types, local variables, parameters etc. across the entire project. It also lets automatically convert variable or method return type between arrays and collections. If any conflicts are found IntelliJ IDEA warns you about them.
REF Link
No, they aren't the same.
'Change' will just swap the type of variable.
'Migrate' is 'smarter', and will search trough all usages and try to solve errors that may occur after just changing the type.This is a situation when you can use migrate and change. Write this code in android studio and try migrate and change, you will see the difference.
This window will be shown if migrating fails

What exactly is a forward declaration with respect to memory?

I understand on a high level what a function declaration does: you declare them at the top of your file so the compiler will know which functions you are calling. However, what does the compiler exactly do with it? I know that functions are written in the text section of memory and expects arguments to be given by a register on the stack. Are function prototypes also placed within the text? Or are forward declarations simply indicators for the linkage editor to use to connect all the files together, and they are "removed" in the final product? Or does the compiler do something else with them?
I have looked around online and could not find a good resource, so if any of you can answer this or give me a resource outlining this specific phenomena, that would be greatly appreciated!
I think there was a misunderstanding in the question, which is my mistake. My question was on how exactly does the C-compiler utilize the forward declarations. It seems from the answers below, it is used during the conversion of c-code to assembly. Is this correct?
A function prototype is simply a way to notify the compiler about how the function should be called, without having to provide any details on the implementation.
All a caller needs to know is how to call it: what parameters to pass and what to expect back.
Everything else should be hidden as much as possible so as to allow proper encapsulation, the ability for a function to change however it wants internally, without breaking anyone currently using it.
By way of example, here's a function prototype used for storing key-value pairs (both strings):
enum kvpErr kvpAdd (char *key, char *value);
This allows the compiler to ensure that you actually pass in two C strings and take an integral error code back. But it reveals nothing about the internals of the function. It may use various forms of balanced trees, a dynamically allocated array, a connection to an SQL database or a text file on an NFS server located in Outer Mongolia.
The bottom line is, you can improve the implementation in any way you wish as long as the function signature itself is kept identical.

How can I make a Stata plugin not depend on the order of variables?

I am writing a plugin for Stata in C++, and it seems to me that accessing the data depends on the order of variables passed to the plugin, as SF_vdata() only takes integer arguments to index the variables.
The best solution I have at the moment, is to first run ds, store the macro containing all variable names, and then call my plugin. My plugin can then search the macro for the variable that it is interested in, and get the index base don its position in the list.
This works, but I would like my plugin not to depend on certain Stata commands being run first. I know this is silly, as the plugin requires the dataset to be formatted in a specific way, but something feels wrong about first having to call ds and store a macro before calling my plugin.
Is there anyway to access the order of variable names from inside the plugin if ds is not called first?
I agree with Nick. Unfortunately your macro solution is the only answer, and is what I use. You can only access the data directly using the SF_data functions, as a "matrix", and that's all you get by default, there are no headers like in a table. I use macros to save all the data information and pass the whole dataset, reading the variable I'm interested in, just like you, and even wrote translators to retain the format settings, but have not yet used the value labels.