In Angular ngClass can we combine more than one conditions? - ionic4

[ngClass]="{'hasDocument': item.communication_file != '', 'no_Doc': item.communication_file == '' }">
For example, how to do the following?
[ngClass]="{'hasDocument': item.communication_file != '' && item.communication_file != null, 'no_Doc': item.communication_file == '' }">
Is it possible to do so? If yes, what is the correct syntax?

But you are missing "()" in this braces define "True" and "False".
[ngClass]="{'hasDocument': (item.communication_file != '' && item.communication_file != null), 'no_Doc': item.communication_file == '' }"
if you want to use more than one condition use braces.

Related

Setting condition for vue bootstrap checkbox component prop

I am new to Vue and I have to fix the following issue for work. I have a Bootstrap Vue b-form-checkbox-group similar to the one bellow. The listofOption comes from backend and from legacy databses. Sometime the ColumnName is empty or null. Right now it shows null or a blank space, but I want it to print the text "_blank" if that is the case.
<b-form-checkbox-group id="flavors"
v-model="status"
:options="listofOption"
:text-field="ColumnName"
:value-field="ColumnName"
name="flavors" class="ml-4" aria-label="Individual flavours" stacked>
</b-form-checkbox-group>
I have replaced the :text-field with the following line but can't make it work:
:text-field="[(ColumnName && ColumnName != null && ColumnName != '') ? ColumnName : '_blank']"
You could pass that value binding via function.
getColumnName(ColumnName) {
return (ColumnName && ColumnName != '') ? ColumnName : '_blank'
}
Then:
:text-field="getColumnName(ColumnName)

How to filter Sanity posts by category title?

Here what I've done in vision
*[_type == "post" && categories == SOCIAL ]{
_id, title
}
It returned
No documents found in dataset production that match query:
*[_type == "post" && categories == SOCIAL ]{
_id, title
}
You have to format it like so:
*[_type == "post" && categories == "SOCIAL" in categories[]->title]{
title,
slug,
body
}
If nothing shows up then there are no posts associated with that category. Categories are also case sensitive, so make sure your capitalization is right.
*[_type == "post" && "social" in categories[]->title]{
title
}
*[_type == 'post' && category->name == 'Technology']
Can also try this in cases where your categories are not saved as arrays.
What worked for me is instead of searching by the name of the category i searched using the ._ref property of the category.
It would look something like this
*[_type == "post" && categories == categories._ref]

How to write Case statement in SSIS expression

I have a small condition in SQL Code. How can I write that in SSIS in Derived column task.
CASE WHEN SaleProduct IS NULL AND ReProduct IS NULL THEN ''
WHEN SaleProduct IS NOT NULL AND ReProduct IS NULL THEN SaleProduct
WHEN SaleProduct IS NULL AND ReProduct IS NOT NULL THEN SaleProduct
ELSE
SaleProduct +';'+ ReProduct END As COL
I have tried with the following expression
but not getting anything
(ISNULL( [SaleProduct] )&& [ReProduct] == "") : ? "0"
" ------------------------"
UNKNOWN
can anyone help me on this ...
CASE statements can be replicated by using Conditional operator in the Derived column transformation.
For your condition the expression would be like
((ISNULL(SaleProduct) == True && ISNULL(ReProduct) == True) ? " " :((ISNULL(SaleProduct) == False && ISNULL(ReProduct) == True)? SaleProduct :(ISNULL(SaleProduct) == True && ISNULL(ReProduct) == False)? SaleProduct : SaleProduct+";"+ReProduct)
You need to use Ternary operator in Derived column transformation:
To understand and depict your condition:
( ISNULL([SaleProduct]) && ISNULL([ReProduct]) ) ? " " :
( !ISNULL([SaleProduct]) && ISNULL([ReProduct]) ) ? [SaleProduct] :
( ISNULL([SaleProduct]) && !ISNULL([ReProduct]) ) ? [SaleProduct] : ( [SaleProduct]+";"+[ReProduct] )
But tabs causes error in Derived column transformation. Hence it should actually be:
(ISNULL([SaleProduct]) && ISNULL([ReProduct])) ? " " : (!ISNULL([SaleProduct]) && ISNULL([ReProduct])) ? [SaleProduct] : (ISNULL([SaleProduct]) && !ISNULL([ReProduct])) ? [SaleProduct] : ([SaleProduct]+";"+[ReProduct])

SQL error when running X++ class in Dynamics AX: The multi-part identifier "D.DATAAREAID" could not be bound

I am getting an SQL error when I try to run my x++ class in Microsoft Dynamics AX. I've researched the issue around this site and google with no luck.
Here is the problematic query:
select custTable
order by custTable.AccountNum
join dirpartytable
join personDetails
outer join address
where custTable.PartyId == dirpartytable.PartyId && //custTable.TableId == dirpartytable.TableId &&
dirPartyTable.FirstName!='' && dirPartyTable.LastName!='' &&
custTable.PartyId == personDetails.PartyId &&
dirpartytable.RecId == address.AddrRecId && dirpartytable.TableId == address.AddrTableId &&
custTable.BBBStoreID != '' && custTable.MainContactId != '' && custTable.CRM_AccountNum == ''
And here is the error I am getting:
Error Message (04:52:10 pm) Cannot select a record in Customers (CustTable). Customer account: , .
The SQL database has issued an error.
Info Message (04:52:10 pm) SQL error description: [Microsoft][SQL Native Client][SQL Server]The multi-part identifier "D.DATAAREAID" could not be bound.
Info Message (04:52:10 pm) SQL statement: SELECT A.ACCOUNTNUM,A.NAME,A.ADDRESS,A.PHONE,A.TELEFAX,A.INVOICEACCOUNT,A.CUSTGROUP,A.LINEDISC,A.PAYMTERMID,A.CASHDISC,A.CURRENCY,A.SALESGROUP,A.BLOCKED,A.ONETIMECUSTOMER,A.ACCOUNTSTATEMENT,A.CREDITMAX,A.MANDATORYCREDITLIMIT,A.DIMENSION,A.DIMENSION2_,A.DIMENSION3_,A.VENDACCOUNT,A.TELEX,A.PRICEGROUP,A.MULTILINEDISC,A.ENDDISC,A.VATNUM,A.COUNTRYREGIONID,A.INVENTLOCATION,A.DLVTERM,A.DLVMODE,A.MARKUPGROUP,A.CLEARINGPERIOD,A.ZIPCODE,A.STATE,A.COUNTY,A.URL,A.EMAIL,A.CELLULARPHONE,A.PHONELOCAL,A.FREIGHTZONE,A.CREDITRATING,A.TAXGROUP,A.STATISTICSGROUP,A.PAYMMODE,A.COMMISSIONGROUP,A.BANKACCOUNT,A.PAYMSCHED,A.NAMEALIAS,A.CONTACTPERSONID,A.INVOICEADDRESS,A.OURACCOUNTNUM,A.SALESPOOLID,A.INCLTAX,A.CUSTITEMGROUPID,A.NUMBERSEQUENCEGROUP,A.LANGUAGEID,A.PAYMDAYID,A.LINEOFBUSINESSID,A.DESTINATIONCODEID,A.GIROTYPE,A.SUPPITEMGROUPID,A.GIROTYPEINTERESTNOTE,A.TAXLICENSENUM,A.PAYMSPEC,A.BANKCENTRALBANKPURPOSETEXT,A.BANKCENTRALBANKPURPOSECODE,A.CITY,A.STREET,A.PAGER,A.SMS,A.PACKMATERIALFEELICENSENUM,A.DLVREASON,A.GIROTYPECOLLECTIONLETTER,A.SALESCALENDARID,A.CUSTCLASSIFICATIONID,A.SHIPCARRIERACCOUNT,A.GIROTYPEPROJINVOICE,A.INVENTSITEID,A.ORDERENTRYDEADLINEGROUPID,A.SHIPCARRIERID,A.SHIPCARRIERFUELSURCHARGE,A.SHIPCARRIERBLINDSHIPMENT,A.PARTYTYPE,A.PARTYID,A.SHIPCARRIERACCOUNTCODE,A.PROJPRICEGROUP,A.GIROTYPEFREETEXTINVOICE,A.SYNCENTITYID,A.SYNCVERSION,A.SALESDISTRICTID,A.SEGMENTID,A.SUBSEGMENTID,A.RFIDITEMTAGGING,A.RFIDCASETAGGING,A.RFIDPALLETTAGGING,A.COMPANYCHAINID,A.MAINCONTACTID,A.IDENTIFICATIONNUMBER,A.PARTYCOUNTRY,A.PARTYSTATE,A.GIROTYPEACCOUNTSTATEMENT,A.COMPANYTYPE_MX,A.RFC_MX,A.CURP_MX,A.STATEINSCRIPTION_MX,A.EINVOICE,A.CREDITCARDADDRESSVERIFICATION,A.CREDITCARDCVC,A.CREDITCARDADDRESSVERIFICATI292,A.CREDITCARDADDRESSVERIFICATI293,A.USECASHDISC,A.CASHDISCBASEDAYS,A.USEPURCHREQUEST,A.ANNIVERSARY,A.CHILDRENNAMES,A.MARITALSTATUS,A.PROFESSION,A.BIRTHDATE,A.SPOUSE,A.WEBCUSTOMERID,A.FIRSTNAME,A.LASTNAME,A.MIDDLENAME,A.SPOUSEBIRTHDATE,A.GENDER,A.BBBNEWNAME,A.BBBUPDATENAME,A.BBBSTOREID,A.IGNMAINCONTACTID,A.EMAIL2,A.BBB_EMAIL2,A.CRM_ACCOUNTNUM,A.IGN_FIRSTNAME,A.MODIFIEDDATETIME,A.CREATEDDATETIME,A.RECVERSION,A.RECID,B.GENERATIONALSUFFIX,B.NAME,B.SALUTATION,B.PERSONNAMEORDER,B.LANGUAGEID,B.TYPE,B.PREFIX,B.PROFESSIONALSUFFIX,B.FIRSTNAME,B.MIDDLENAME,B.LASTNAME,B.PARTYID,B.NAMEALIAS,B.MODIFIEDDATETIME,B.MODIFIEDBY,B.CREATEDDATETIME,B.CREATEDBY,B.RECVERSION,B.RECID,C.PARTYID,C.NICKNAME,C.INITIALS,C.CHILDRENNAMES,C.BIRTHDATE,C.MARITALSTATUS,C.ANNIVERSARYDATE,C.HOBBIES,C.GENDER,C.SIPECOMMUNICATIONTYPEID,C.BBB_AGEGROUP,C.BBB_INCOMELEVEL,C.BBB_RINGSIZE,C.BBB_SPOUSERINGSIZE,C.BBB_CLIENTINFORMATION,C.BBB_SIXMONTHFOLLOWUP,C.BBB_PREFERREDCONTACT,C.BBB_SPOUSE_BIRTHDAY,C.BBB_SPOUSE_NAME,C.BBB_DATASOURCE_NAME,C.BBB_DATASOURCE_DATE,C.BBB_JEWELRY_PURCHASER,C.BBB_ZIP_FOUR,C.BBB_CONVERTED_DATE,C.BBB_CONVERTED_DESC,C.BBB_CONVERTED_PROSPECT,C.BBB_IS_VAULT_MEMBER,C.BBB_EM_UNSUBSCRIBE,C.BBB_DM_UNSUBSCRIBE,C.BBB_EM_BOUNCES,C.BBB_DM_BOUNCES,C.BBB_DO_NOT_CALL,C.MODIFIEDDATETIME,C.MODIFIEDBY,C.CREATEDDATETIME,C.CREATEDBY,C.RECVERSION,C.RECID,D.ADDRTABLEID,D.ADDRRECID,D.LINENUM,D.TYPE,D.NAME,D.ADDRESS,D.PHONE,D.TELEFAX,D.COUNTRYREGIONID,D.ZIPCODE,D.STATE,D.COUNTY,D.TELEX,D.URL,D.PHONELOCAL,D.CELLULARPHONE,D.EMAIL,D.TAXGROUP,D.CITY,D.STREET,D.PAGER,D.SMS,D.LATITUDE,D.LONGITUDE,D.SALESCALENDARID,D.TIMEZONE,D.DLVTERM,D.DLVMODE,D.SHIPCARRIERID,D.SHIPCARRIERBLINDSHIPMENT,D.SHIPCARRIERACCOUNT,D.SHIPCARRIERACCOUNTCODE,D.SHIPCARRIERRESIDENTIAL,D.BBB_ZIP4,D.RECVERSION,D.RECID,A.MEMO,B.MEMO FROM {oj CUSTTABLE A LEFT OUTER JOIN DIRPARTYTABLE B ON ((D.DATAAREAID=?) AND (((((((((A.PARTYID=B.PARTYID) AND (B.FIRSTNAME<>?)) AND (B.LASTNAME<>?)) AND (A.PARTYID=C.PARTYID)) AND (B.RECID=D.ADDRRECID)) AND (D.ADDRTABLEID=?)) AND (A.BBBSTOREID<>?)) AND (A.MAINCONTACTID<>?)) AND (A.CRM_ACCOUNTNUM=?)))},DIRPARTYTABLE B,DIRPERSONPARTYDETAIL C WHERE (A.DATAAREAID=?) AND (B.DATAAREAID=?) AND (C.DATAAREAID=?) ORDER BY A.DATAAREAID,A.ACCOUNTNUM
Any suggestions or ideas would be greatly appreciated!
What happens here is that the generated query doesn't include all your tables. The reason for this is weirdness in AX when combining inner and outer joins in the same query.
See this blog post
The solution would be to convert the inner join to an outer join, which will off course give you wrong results as it will return your records even if it doesn't have a matching dirpartytable or persondetails row.
If you can have customers without a partytable or persondetails row you would need to filter in your code.
Also, if you use all outer joins you need to position your where clauses more carefully.
Some examples:
//Works
select custTable
order by custTable.AccountNum
outer join dirpartytable
where custTable.PartyId == dirpartytable.PartyId
outer join address
// && //custTable.TableId == dirpartytable.TableId &&
where dirPartyTable.FirstName!='' && dirPartyTable.LastName!='' &&
dirpartytable.RecId == address.AddrRecId && dirpartytable.TableId == address.AddrTableId &&
custTable.MainContactId != '' ;//&& custTable.CRM_AccountNum == ''
//Works
select custTable
order by custTable.AccountNum
join dirpartytable
join address
where custTable.PartyId == dirpartytable.PartyId && //custTable.TableId == dirpartytable.TableId &&
dirPartyTable.FirstName!='' && dirPartyTable.LastName!='' &&
dirpartytable.RecId == address.AddrRecId && dirpartytable.TableId == address.AddrTableId &&
custTable.MainContactId != '' ;//&& custTable.CRM_AccountNum == ''
//Doesnt work
select custTable
order by custTable.AccountNum
join dirpartytable
where custTable.PartyId == dirpartytable.PartyId
outer join address
// && //custTable.TableId == dirpartytable.TableId &&
where dirPartyTable.FirstName!='' && dirPartyTable.LastName!='' &&
dirpartytable.RecId == address.AddrRecId && dirpartytable.TableId == address.AddrTableId &&
custTable.MainContactId != '' ;//&& custTable.CRM_AccountNum == ''
//Doesnt work
select custTable
order by custTable.AccountNum
join dirpartytable
outer join address
where custTable.PartyId == dirpartytable.PartyId && //custTable.TableId == dirpartytable.TableId &&
dirPartyTable.FirstName!='' && dirPartyTable.LastName!='' &&
dirpartytable.RecId == address.AddrRecId && dirpartytable.TableId == address.AddrTableId &&
custTable.MainContactId != '' ;//&& custTable.CRM_AccountNum == ''
I don't have access to AX09 but I think your problem is because you're mixing company-specific tables with non-company specific tables. DirPartyTable has a property called SaveDataPerCompany=No, which means there is no DataAreaId column, while CustTable does.
I can't remember the format of the address table and if it's company-specific or not, but I'd look at that. Also, check into cross-company selects.

Condition in kendo grid ClientTemplate

I am using kendo grid in asp.net mvc4. A column of a grid is Email, so I make a link to the column like that:
col.Bound(con => con.EmailName).Title("Email").Width(120).ClientTemplate(" #=EmailName == null ? '': EmailName#").Filterable(true);
It's Working well. But, I also have to field DoNotEmail and DoNotEmailMarketingCampaigns Whose are Boolean. I want to make the link if both field are false, otherwise I will not make a link. I tried following way:
col.Bound(con => con.EmailName).Title("Email").Width(120).ClientTemplate("#if(!DoNotEmailMarketingCampaigns && !DoNotEmail) { # #=EmailName == null ? '': EmailName# #} else { #=EmailName == null ? '': EmailName# } #").Filterable(true);
but it's not serving my purpose. Any suggestions?
Finally Done with following Code:
col.Bound(con => con.EmailName).Title("Email").Width(120).ClientTemplate("#if(!DoNotEmailMarketingCampaigns && !DoNotEmail) { # #=EmailName == null ? '': EmailName# #} else {# #=EmailName == null ? '': EmailName# #} #").Filterable(true);