Getting the current value in message box

I have to create a message box which should display the emplId and empname of the selected record in the emplTable Form and should contain three fields as

1. Employee id :

2: Employee old name :

3.Employee new name;

Now, field 1 i.e Employee id should have the emplId of the current record, name should have empName of the particular employee and field 3 should be a blank field in which we enter a new name such that it updates the empname.

any suggestions would be much helpful.



And what’s the problem? You don’t know how to read the active record in a form? You don’t know how to create a dialog? Or something else?

dialog has been created but i need active record values rather than blank ones

i don’t know how to get those values

The current record in the form is in a variable of the same name as the data source. If your data source is called EmplTable, the variable is emplTable.

If your problem is actually in passing the record to your dialog, you’ll have to tell us how you’re opening the dialog.

My Dialogue box appears when i clicks on a menu button which i have created as “Change employee name”(in Function Button) from emplTable form.

So do you have any other question?

I searched on internet and found out that it will take values with the help of runbase (of which i am not at all aware of), so kindly guide me how can i get those current record values in my dialogue box .

That would be very helpful for me

Thanks in advance

Regards Shubham

You still didn’t tell me how you’re opening your dialog. I can’t tell you how to change your code if I don’t know what code it is.

void clicked()


dialog dlg;

dialogField dlgField;

emplId emplId;

Name dlgEmpName;


dlg = new dialog(“Change employee name”);

//This field should have current emplId

dlgField = dlg.addField(TypeId(EmplId),“Employee Id”);



//This field should have current empName

dlgField = dlg.addField(TypeId(Name),“Present employee name”);



//Below field is almost correct with only the value entered should get inserted into the current emplName

dlgField = dlg.addField(TypeId(Name),“New employee name”);







When you’re constructing a dialog in code, you have to explicitly set field values. For example:


Alternatively, you can do it during adding the field by addFieldValue().

Trying to set the value in addField() is wrong, because the second parameter sets the label, not the value.

Sorry Martin , its not working as well

check this out :


static void smylDmgModification(Args _args)


emplTable empltab;

dialog dlg;

dialogField dlgEmplId;

dialogField dlgNewName;

dialogField dlgOldName;

emplId emplId;

Name dlgEmpName;


dlg = new dialog(“Change employee name”);

dlgEmplId = dlg.addField(TypeId(EmplId),“Employee Id”);



//This should be an uneditable Field having the old Name

dlgNewName = dlg.addField(TypeId(Name),“Present employee name”);



//Below field is almost correct with only the value entered should get inserted into the current emplName

dlgOldName = dlg.addField(TypeId(Name),“New employee name”);







It does exactly what you told it to do.

You’re not taking values from the data source, you’re using your own empltab variable instead and you never set any value into it, therefore it’s always empty.

Its not taking the values from the very beginning and how can i take values from data source is the only question that i am asking from the very beginning.

I already answered that in my second reply.

The code that i have written was click method on menu button , now i wrote class for insertion and updation of the required field values . I hope it will work now.

Thanks a lot for all your answers.

for Getting Active record…

empltab = emplTable_ds.cursor();

Add this affter the declaration part.

Finally found something that has met my requirements , as i have to write a class for it of whose dialog method is

Object dialog()


DialogRunBase dlg = super();


dlgEmpId = dlg.addField(TypeId(EmplId),“Employee Id”);


dlgNameExisting = dlg.addField(TypeId(Name),“Present employee name”);


dlgNameUpdated = dlg.addField(TypeId(Name),“New employee name”);




return dlg;


I have a last dialog box from whome i need to update my empltable(name) field

guide me how can i write the select statment for updating a record whose value is being taken from a dialogue box 8156.dmg121.jpg

I’m glad you finally utilized my solution, even you didn’t mark it as the verified answer.

Nevertheless your question about updating a record doesn’t belong to the thread named “Getting the current value in message box”. Please explain your new question in a new thread.