To save Record on form according to user session.

Hello Everyone,

I have a form which has 6 fields. Now what i want is to save the values of these fields user session wise,

means if suppose “User A” select some data on the form and close it, now again “User B” has selected again some different values on the same form, Now when “User A” again open the Form. he should get the values selected by him only, and not the Values selected by “User B”. So the values should get saved according to user session wise.

I am not getting how to achieve this.

Thanks & Regards

Pranav

Add a 7th field to your table as “user Id”. Form level you get it developed like “The user who opens the form can see only that user’s record”

-First time when user1 opens, he cant see nothing, then he creates new record which will be saved for User1"

-when user2 opens the form he cant see user1s data as active method is coded in such a way.

Hope it helps

Hi Santosh,

Thanks for the reply.

Am also trying for the same, will update you if it works.

Thanks & Regards

Pranav :slight_smile:

You can make the system to store the created user information without adding a field, set the createdBy property to Yes on the table.

see \Forms\LedgerJournalTable, which will show the similar functionality when Show user created only check mark

Hi

Now i have been able to show 4 out of 5 fields according to user session, only there is one date field which is not coming correct.

Like if User A has select 17 oct 2013, and close the form, and if user B select 16-Sep 2013, then if user A again opens the form its showing the Date value of User B.

I just create a table and store the Values there on the Form’s close(). And on form’s run(), i just again insert the values to the form’s field. below is the code:

Close()

{

UserName curUserName;
DemoTable session;

curUserName = (select userInfo where userInfo.id == curUserId()).Name;

select * from session
where session.DRV_UserName == curUserName;

if(session)
{
ttsBegin;
select forUpdate session where session.DRV_UserName == curUserName;

ttsBegin;
session.CustAccount = Customer.text();
session.ActiveDate = Activedate.dateValue();
session.Enum = Enum.selection();
session.SalesPriceGroup = SalesPriceGroup.text();
session.Currency = Currency.text();
session.UserName = curUserName;
session.update();
ttsCommit;
}
else
{
ttsBegin;
session.CustAccount = Customer.text();
session.ActiveDate = Activedate.dateValue();
session.Enum_1 = Enum.selection();
session.SalesPriceGroup = SalesPriceGroup.text();
session.Currency = Currency.text();
session.UserName = curUserName;
session.insert();
ttsCommit;
}

}

run()

{

curUserName = (select userInfo where userInfo.id == curUserId()).Name;

select * from session
where session.DRV_UserName == curUserName;
if(session)
{
custAccount = session.CustAcc;
activeDate = session.ActiveDate;
enum1 = session.Enum_1;
salesPriceGroup = session.SalesPriceGroup;
currencyCode = session.Currency;
}
else
{
custAcc1 = ‘’;
activeDate4 = dateNull();
Enum_1 = Enum_1::Value;
salesPriceGroup = ‘’;
currencyCode = ‘’;
}

//set the last user selection on the field
Customer.text(custAcc1);
Activedate.dateValue(activeDate4);
Enum_1.selection(Enum_1);
SalesPriceGroup.text(salesPriceGroup);
AdditionalSalesPriceReportingCurrency.text(currencyCode);

DemoTable _ds.reread();
DemoTable _ds.research();
DemoTable _ds.refresh();
super();

}

Any Solution to this Problem.

Thanks & Regards

Pranav