Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 |
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';
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';