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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Gunnermate
Partner - Contributor
Partner - Contributor

Type flagging based on cell values

I have two different kind of formats on an ID used in a transportation app, where among others the LoadWeigt is calculated.... LOADID (T-123456 for Main and T-123456-1 for Sub Load) is located the same table field. So a row can either be a 'Main Load' or a 'Sub Load'. When there is a 'Sub Load' I shall always use this row for calculating the LoadWeigt and sometimes there is just a MainID. The Load script function below helps me flag them 

If(WildMatch(LOADID, '*-*-*'), 'Sub Load', 'Main Load') AS LoadType

Now to my question:

I need to distinguish between the 'Main Load's which has 'Sub Load's and the stand alone 'Main Load's based on the LoadID values formatted as described. How can I do that?

The table below shows wished outcome where LoadType is the flag pin pointing what kind of type. It's the "Main2Sub" I can't figure out

LoadID LoadType LoadWeight
T-123456 Main2Sub 50
T-123456-1 Sub 50
T-321654 Main 100
Labels (1)
1 Solution

Accepted Solutions
Gunnermate
Partner - Contributor
Partner - Contributor
Author

I've found a working solution with help from a colleague 🙂

Left Join
LOAD
left(LOADID,index(LOADID,'-',-1)-1) as LOADID,
1 as Main2Sub
Resident "myTable"
Where LoadType='Sub Load';

View solution in original post

1 Reply
Gunnermate
Partner - Contributor
Partner - Contributor
Author

I've found a working solution with help from a colleague 🙂

Left Join
LOAD
left(LOADID,index(LOADID,'-',-1)-1) as LOADID,
1 as Main2Sub
Resident "myTable"
Where LoadType='Sub Load';