Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam_Thomas
Creator
Creator

Create 'virtual' field in table

Hi

 

Is there a way I can create a virtual field within a table in Qliksense loadscript?

I have an 'ActiveDate' field, but would like to have an 'ExpiryDate' field added (which is ActiveDate+1095 days). 

Or if there is another way you can think of doing this all suggestions will be welcomed. I want an actual field rather than just a measure of 'ActiveDate+1095 days' - if possible. 

Thanks

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

You've been a community member since early 2021, you can't be that new... 🙂

LOAD StockpileId,
InternalReference,
FarmId AS [StockpileFarmId],
FieldId,
Tonnage,
CreationDate,
GridReference AS [StockpileGridReference],
CentroidGeom27700 AS [StockpileCentroidGeom27700],
S3ExemptionReference,
S3ExemptionActiveDate,

date(S3ExemptionActiveDate+1095) as ExpiryDate,
StockpileChecklistId,
IsEstimated,
StockpileTypeId,
RolloverTonnage,
BoundaryGeom27700 as [StockpileBoundaryGeom27700] ;

View solution in original post

5 Replies
Or
MVP
MVP

There's absolutely no problem doing that.

Load ActiveDate, Date(ActiveDate+1095) as ExpiryDate

From YourTable;

Sam_Thomas
Creator
Creator
Author

Amazing, thank you. Will try now

 

Sam_Thomas
Creator
Creator
Author

It didn't like it but there's a 100% chance I haven't done it correctly. This is the portion of my load script that loads the Stockpile table (the table in question)

 

LOAD StockpileId,
InternalReference,
FarmId AS [StockpileFarmId],
FieldId,
Tonnage,
CreationDate,
GridReference AS [StockpileGridReference],
CentroidGeom27700 AS [StockpileCentroidGeom27700],
S3ExemptionReference,
S3ExemptionActiveDate (This is the field I was referring to as ActiveDate),
StockpileChecklistId,
IsEstimated,
StockpileTypeId,
RolloverTonnage,
BoundaryGeom27700 as [StockpileBoundaryGeom27700] ;

SQL SELECT StockpileId,
InternalReference,
FarmId,
FieldId,
Tonnage,
CreationDate,
GridReference,
CentroidGeom27700,
S3ExemptionReference,
S3ExemptionActiveDate,
StockpileChecklistId,
IsEstimated,
StockpileTypeId,
RolloverTonnage,
BoundaryGeom27700
FROM COMPANYNAME.dbo.Stockpile;

Where should I be putting in that command you provided? Sorry, very new to this world. 

Or
MVP
MVP

You've been a community member since early 2021, you can't be that new... 🙂

LOAD StockpileId,
InternalReference,
FarmId AS [StockpileFarmId],
FieldId,
Tonnage,
CreationDate,
GridReference AS [StockpileGridReference],
CentroidGeom27700 AS [StockpileCentroidGeom27700],
S3ExemptionReference,
S3ExemptionActiveDate,

date(S3ExemptionActiveDate+1095) as ExpiryDate,
StockpileChecklistId,
IsEstimated,
StockpileTypeId,
RolloverTonnage,
BoundaryGeom27700 as [StockpileBoundaryGeom27700] ;

Sam_Thomas
Creator
Creator
Author

That worked perfectly, thanks. 

I meant new to the load script world! 

Cheers