RelationShip Between DeliveryName Field In SalesTable in Dynamics AX - dynamics-ax-2012

**I Need to retrive the DeliveryName Field From SalesTable..What is the relationShip Between them ??How Can i retrive the DeliveryName From SalesTable **

for the comments you want get DeliveryName from SalesTable but you need the relation between CustInvoiceJour and SalesTable.
The relation is CustInvoiceJour.SalesId == SalesTable.SalesId
Code:
Select DeliveryName from SalesTable where SalesTable.SalesId == CustInvoiceJour.SalesId;

DeliveryName is field on SalesTable - there is no special relation as this is plain text field.

Related

What returns CustInvoiceJour.salesTable

I'm learning to develop dynamics ax 2012 and I need to find the data in salesTable corresponding to a CustInvoiceJour record.
Does the method CustInvoiceJour.salesTable return the whole table or the associated record?
It returns a sales table buffer that has records associated with customer invoice journal.
The return type of the function is tablebuffer as a tablebuffer type salesTable is return from the function as a foreign key relationship is exist between custinvoicejour and salesTable on salesId field.
SalesTable salesTable = SalesTable::find(this.SalesId, _update);
salestable buffer is find from custinvoicejour current buffer field value this.salesId which is pass into salestable function find which returns salestable buffer contains field values.
SalesTable salesTable(boolean _update = false)
{
SalesTable salesTable = SalesTable::find(this.SalesId, _update);
SalesTableDelete salesTableDelete;
SalesTable_RU salesTableRU;
if (!salesTable && this.SalesId && this.SalesType != SalesType::Journal)
{
salesTableDelete = SalesTableDelete::find(this.SalesId);
if (salesTableDelete.SalesTable)
{
[salesTable] = salesTableDelete.SalesTable;
salesTableRU = SalesTable_RU::findBySalesTable(salesTable.RecId);
salesTable.packSalesTable_RU(salesTableRU);
}
}
return salesTable;
}

Remove record from Database in Linq

My picture is :
I want to remove record from Tbl_Category table.
Tbl_category have childs and its child has child and .... to Tbl_File
How I can remove Tbl_Category records ?
Thank you
In Tbl_user , "username" is Primary key and the session username is :
string u = Session["Username"].ToString();
could you please help me to write the query ?
Try this query to delete category from category table object. categoryID is the id you want to delete from table
Tbl_Category category= dbContext.Tbl_Category.Single(x => x.CategoryID== categoryID);
if(category!=null)
{
dbContext.Tbl_Category.Remove(standard1);
dbContext.SaveChanges();
}
Also check the WillCascadeOnDelete() method on context is turned ON or OFF

Filter Product Name in RetailProductDiscount Form productLookup ax 2012

I need to add the field of ProductName filterable in the ProductLookup field in retailPeriodicDiscount form. It is strongly connected to EcoResProduct and I can't use any other lookup field or method.
So, I need to add the product name field to productLookup method. Any suggestions how to do it?
For the product name you have to add the field Name of the table EcoResProductTranslation .Add the table as a joined datasource to the query and filter it by the system language.
sysTableLookup.addLookupfield(fieldNum(EcoResProduct, DisplayProductNumber));
sysTableLookup.addLookupfield(fieldNum(EcoResProduct, SearchName));
sysTableLookup.addLookupfield(fieldNum(EcoResProduct, ProductType));
sysTableLookup.addLookupfield(fieldNum(EcoResProductTranslation, Name));
if (_groupMember.Category)
{
query = RetailGroupMemberLineQueryProvider::containedProductsQuery(_groupMember.Category, true /*includesubcategories*/, _dataAreaId);
}
else
{
query = RetailGroupMemberLineQueryProvider::containedProductsQuery(_groupMember.Category, true /*includesubcategories*/, _dataAreaId);
}
// add datasources and join
qbdsProduct = query.dataSourceTable(tableNum(EcoResProduct));
qbdsProductTranslation = qbdsProduct.addDatasource(tableNum(EcoResProductTranslation));
qbdsProduct.relations(true);
// range for system language
qbdsTranslation.addRange(fieldNum(EcoResProductTranslation, LanguageId)).value(SystemParameters::getSystemLanguageId());
sysTableLookup.parmQuery(query);

From which table can the customer name be retrieved?

I want to retrieve the customer name. But in table CustTable there is no field for the customer name. From which table can the customer name be retrieved?
You can retrieve the name using the method name() in table CustTable.
Select the table CustTable and then pass on the result of the method name().
Example:
CustTable custTable;
select custTable where custTable.AccountNum == "YourCustomer";
info(custTable.name());

Accessing Fields of a has_one relation Silvestripe

I have a DataObject Team that has a has_one relation to Member. I would like to use the ORM to search Team but be able to filter records by the value of one field of the related Member table. Just to be more clear, I can achieve the same result with SQL:
SELECT * FROM Member
LEFT JOIN Team ON Team.MemberID=Member.ID
WHERE Member.CityID=142
AND Team.Target='Boy'
AND Team.GenreID=51
AND Team.Fyr <= 9
AND Team.Tyr >= 9
Okay, I got it. The answer is:
$teams= Team::get()->filter(array('Member.CityID:ExactMatch' => $var));
and later simply filter $teams

Resources