Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dots (.) in SOQL Load.. SOQL doesn't allow aliasing, the dilemma!

So below is a simplified version of my query..

Opportunity:

LOAD     Id,

Name,

OwnerId,

Account.OwnerId,

Broker_Account__r.OwnerId;

SQL SELECT Id,

Name,

OwnerId,

Account.OwnerId,

Broker_Account__r.OwnerId

FROM Opportunity

The problem is:

  • QlikView doesn't load "Account.OwnerID" and "Broker_Account__r.OwnerId" because it can't find the field (Script Error: Field not found - <Account.OwnerId>)
  • SOQL doesn't allow for field Aliasing.

So, QV wants me to alias the field because it doesn't like dots, and SOQL won't let me alias and will include the dot!

Any idea on how I get around this?

1 Solution

Accepted Solutions
Not applicable
Author

Wanted to update the thread in case someone was looking for an answer.

I created two Mapping tables with the joined fields and applied the map within the LOAD statement of the Opportunity table

View solution in original post

16 Replies
francoiscave
Partner - Creator III
Partner - Creator III

Hi Fadi,

If you use the brackets ? or maybe the dobble quote ""

Like [Broker_Account__r.OwnerId]

François

jjordaan
Partner - Specialist
Partner - Specialist

Hi Fadi,

You can use the replace statement, like Replace(Replace([SQL Table Name],'.','_'),'/','_')

Hope this helps.

Not applicable
Author

Sadly, that didn't work.

Not applicable
Author

Could you elaborate on how to use the replace? If used in the Load statement it'll cause the same issue with the dot, no?

jjordaan
Partner - Specialist
Partner - Specialist

This is how I use it.

Tables:

LOAD * INLINE

[

    SQLTableName, SQLTableAlias, Active

  Item, Item, 1

];

Tables2BeLoaded:

LOAD

  Replace(Replace(SQLTableName,'.','_'),'/','_') AS SQLTable

  ,SQLTableAlias

  ,Incremental

  ,Active

Resident Tables

Where Active = 1;

And then start the loop over the tables with a FOR NEXT

Not applicable
Author

HI there,

You can try this -

Opportunity:

SQL SELECT Id,

Name,

OwnerId,

Account.OwnerId,

Broker_Account__r.OwnerId

FROM Opportunity


Store Opportunity into Opportunity.qvd(qvd);

Drop Table Opportunity;


Opportunity:

Load *

From Opportunity.qvd (qvd);


Now in the above qvd table you can do aliasing or any other qlikview function you want.


Thanks

Not applicable
Author

I attempted this as a first step:

Opportunity:

SQL SELECT Id,

Name,

OwnerId,

Account.OwnerId,

Broker_Account__r.OwnerId

FROM Opportunity

The result was pulling correctly for Id, Name and Owner Id. But it pulled the fields Account.OwnerId and Broker_Account__r.OwnerId as "Account" and "Broker_Account__r" and gave them all null values.

I verified that the SOQL itself works in salesforce, so I know it's not returning nulls there.

My guess is that it pulled data for Account.OwnerId and Broker_Account__r.OwnerId but wrote data in QV datamodel for "Account" and "Broker_Account__r" which don't exist, thus NULL...

anbu1984
Master III
Master III

Try this

Opportunity:

LOAD     Id,

Name,

OwnerId,

OwnerId_Account,

OwnerId_Broker_Account__r ;

SQL SELECT Id,

Name,

OwnerId,

Account.OwnerId As OwnerId_Account,

Broker_Account__r.OwnerId As OwnerId_Broker_Account__r

FROM Opportunity

Not applicable
Author

Sadly that did not work, SOQL doesn't allow aliasing.