Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

double rows

Hi,

I need help to take away double rows in my application, see attached file. The only row that should be left are third row. Can I do something in the script?

/Jessica

1 Solution

Accepted Solutions
Not applicable
Author

Try adding this to the script:

CSTREASON: //This names the table so you can join to it.

SQL SELECT //bDefault,

    //bPTDefRecWaste,

    //bPTDefWaste,

    //bWebBreak,

    //nFacEventTypeId,

    nId as ReasonId,

    //nSortOrder,

    //strCode,

    strName as Stopporsak

FROM "mwm_ct_jms".dbo.CSTREASON WHERE strName NOT LIKE '-';

Left Keep (CSTREASON)

SQL SELECT //bLastStop,

    //bManual,

    //fEndOffset,

    //fOffset,

    //fRadius,

    //nAutomaticEventTypeId,

    //nColumnB,

    //nCopies,

    //nCopyOf,

    //nDampPercentage,

    //nEventTypeId,

    //nExtraCopiesChange,

    //nFacEventTypeId,

    //nForm,

    nId,

    //nMachineId as MachineId,

    //nMainId,

    nOperatorId,

    nPaperTension,

    //nProcessTypeId,

    nReasonId as ReasonId,

    //nRepLineRunId,

    nRepMachineRunId as RepMachineRunId,

    //nRepProductRunId,

    //nRepRollId,

    //nRepSessionId,

    //nRepVersionRunId,

    //nRevolutionSpeedBeforeStop,

    //nShiftEventId,

    //nShiftId,

    //nShiftSupervisorId,

    nUnitId as UnitId,

    nUnitTypeId as UnitTypeId,

    //nUsageId,

    strComment as Kommentar,

    //strPictureFile,

    tmEndTime,

    //tmInserted,

    tmTime,

    Year (tmTime) as År,

    Month (tmTime) as Mån,

    Day (tmTime) as Dag

FROM "mwm_ct_jms".dbo.REPEVENT;

View solution in original post

9 Replies
Not applicable
Author

Try adding Inner Joins to your script.

Not applicable
Author

Can you be more specific? Example?

Thanks

/Jessica

Not applicable
Author

Can you post your script?

johnw
Champion III
Champion III

How do you know it's the third row you want?  Whatever that condition is, add it to the script that loads the table.

Not applicable
Author

Marcsliving -  You can find the script above. ct.qvs

John - I think I want the third row because there must allways be a value in the column "stopporsak"

Not applicable
Author

How do all your tables connect? A table view would be helpful (Would take awhile to search through for matching fields to build myself)

If you always need the field Stopporsak to be populated, then you need to place a join on that table with the connecting table (This is if stopporsak is a description table if the table with stopporsak actually has records with no entry to can place a where clause like: from table where stopporsak<>'').

Not applicable
Author

See view CT  file above.

Yes,there must allways be a value in Stopporsak

Not applicable
Author

Try adding this to the script:

CSTREASON: //This names the table so you can join to it.

SQL SELECT //bDefault,

    //bPTDefRecWaste,

    //bPTDefWaste,

    //bWebBreak,

    //nFacEventTypeId,

    nId as ReasonId,

    //nSortOrder,

    //strCode,

    strName as Stopporsak

FROM "mwm_ct_jms".dbo.CSTREASON WHERE strName NOT LIKE '-';

Left Keep (CSTREASON)

SQL SELECT //bLastStop,

    //bManual,

    //fEndOffset,

    //fOffset,

    //fRadius,

    //nAutomaticEventTypeId,

    //nColumnB,

    //nCopies,

    //nCopyOf,

    //nDampPercentage,

    //nEventTypeId,

    //nExtraCopiesChange,

    //nFacEventTypeId,

    //nForm,

    nId,

    //nMachineId as MachineId,

    //nMainId,

    nOperatorId,

    nPaperTension,

    //nProcessTypeId,

    nReasonId as ReasonId,

    //nRepLineRunId,

    nRepMachineRunId as RepMachineRunId,

    //nRepProductRunId,

    //nRepRollId,

    //nRepSessionId,

    //nRepVersionRunId,

    //nRevolutionSpeedBeforeStop,

    //nShiftEventId,

    //nShiftId,

    //nShiftSupervisorId,

    nUnitId as UnitId,

    nUnitTypeId as UnitTypeId,

    //nUsageId,

    strComment as Kommentar,

    //strPictureFile,

    tmEndTime,

    //tmInserted,

    tmTime,

    Year (tmTime) as År,

    Month (tmTime) as Mån,

    Day (tmTime) as Dag

FROM "mwm_ct_jms".dbo.REPEVENT;

Not applicable
Author

Thanks! Now it works