there is a unique combo between event id and ticket id ,if the combo repeats the validation should throw at 1st instance when selecting ticket id.but the validation is triggered when i select the T1 twice.
but i wrote the same method with 3 arguments as below.its working fine.
-----------------------------------
public static boolean RecordExist(Event_ID _eventid,Agent_ID _agentid ,TicketId _ticketid)
{
AgentTicketAllocatedTable agentticketallocated;
select agentticketallocated where agentticketallocated.Event_ID == _eventid &&
agentticketallocated.Agent_ID == _agentid && agentticketallocated.TicketId == _ticketid;
{
if(agentticketallocated.RecId)
{
info('@EM:EM092');
return false;
}
else
{
return true;
}
}
}
/// <summary>
///
/// </summary>
/// <param name = "_fieldIdToCheck"></param>
/// <returns></returns>
public boolean validateField(FieldId _fieldIdToCheck)
{
boolean ret;
ret = super(_fieldIdToCheck);
switch(_fieldIdToCheck)
{
case(fieldNum(AgentTicketAllocatedTable,TicketId)):
AgentTicketAllocatedTable::RecordExist(this.Event_ID,this.Agent_ID,this.TicketId);
break;
}
return ret;
}
thank you
thank you
Hi, you can create a table index, add both fields and set Allow duplicate to No. This way you don't have to write any code.
And in your code, you have created static method for same table which is not required.. A simple select first only statement to check if eventId and TicketId exists will do. However, you can still consider unique index instead of code.
You need to return the Boolean value to validate method. Like below.
Case(fieldnum(TicketPriceTable, TicketId)): ret = TicketPriceTable::RecordCheck(this.EventId,this.TicketId); break;
Thanks,
Girish S.
yes, warning is thrown after selecting multiple times
i wrote static method and called it in the validate field method
Hi,
Are you saying that waring is throwing after selecting TicketId multiple times?
Can you tell me in which method did you add the validation?
Thanks,
Girish S.
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,817
Most Valuable Professional
nmaenpaa
101,156