Simply prompting the user for a value in X++ code

I know this is a really stupid question - I’m new to X++ and AX. At any rate, if I need to quickly prompt the user for a 1 value in any X++ code, a string if nothing else, what function should I use? I suppose I’m looking for something akin to:

x = InputBox(“Type in something:”)

in VB, thanks for any help.

Really? No answer? What I was looking for was a simple function/method to prompt the user for a value, just a string value. I realize that in finished polished production code that normally you’d have a form as an interface but a quick and dirty prompt asking the user to type something in still comes in handy sometimes. Surely, x++ has something like that, kind of the inverse of PRINT or info(). Am I asking this in the wrong forum?

Hi Mike,

If the control is bound, set mandatory property on the field to Yes. This is the common approach in DAX. Example - ItemGroupId field in Inventory table.

If it is not bound, you can use text() property. For this to work, you need to set AutoDeclaration property of that control to Yes. Once set, then you can override ‘modified’ method of that control and write -


boolean ret = super();
;

if (ret)
{
if (.text() == ‘’)
{

ret = false;
}

return ret;
}


Regards,

Hi,

or in ValidateWrite method you can write the code.

if(!table.field)

ret = checkfailed(strfmt(“Type in something”));

return ret;

Hope it will help you

Regards

Kranthi