Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Inline Mapping in Load Script?

I have a field "add_date", which is a timestamp field in the database (date/time). Is there a way to create an inline table that designates any date older than 14 days as "Past Due" and those that are not as "On Track"?

Something along the lines of this for a true/false field, maybe?

 

LOAD

* INLINE
[
add_date, idle_request
'{>Today()-14}','1'
'{<Today()-14}','0'
]

;

1 Solution

Accepted Solutions
Not applicable
Author

try something like this:

Load *,If(add_date>Today()-14,1,0) as idle_request;

SQL SELECT * FROM TABLEX;

Kiran.

View solution in original post

7 Replies
Not applicable
Author

Would an if statement not work rather than an inline?

If(add_date>Today()-14,1,0)

Not applicable
Author

ALSO - if anyone can help me inject this condition into my existing inline table (which is used as an artificial means to sort priority), that'd be even better:

TaskPriority:

LOAD

    TaskPriority,

AutoNumber(priority_name & '-' & system_name) as priorityKey;

LOAD * INLINE [

    priority_name, system_name, TaskPriority

    Critical, 'System Name 1', 1

    Critical, 'System Name 2', 2

    Critical, 'System Name 3', 3

    Standard, 'System Name 1', 4

    Standard, 'System Name 2', 5

    Standard, 'System Name 3', 6

    ];

The "stale" requests would need to appear on top when sorted by task priority.

Not applicable
Author

I'm not sure an if statement would work, since I need an actual field indicating whether or not a request is older than 14 days.

Not applicable
Author

What should add_date be compared with? If it should compare with the day document is reloaded then Felim Shanaghy, suggesion will work as it creates a flag field in the data model.

Kiran.

Not applicable
Author

Since we're looking for dates that are 14 days old, add_date needs to be compared to today's date.

Not applicable
Author

try something like this:

Load *,If(add_date>Today()-14,1,0) as idle_request;

SQL SELECT * FROM TABLEX;

Kiran.

Not applicable
Author

This worked, Kiran, thanks.