1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | public static void copyRangeFilters(Query _originQuery, Query _destinyQuery, QueryBuildDataSource _originDataSource, QueryBuildDataSource _destinyDataSource, fieldName _ledgerDimensionFieldName = '') { QueryBuildRange queryBuildRangeOrigin; QueryFilter originQueryFilter; QueryBuildRange queryBuildRangeAdded; QueryFilter newFilter; container dimensionCriteria; List dimensionRanges; ListEnumerator listEnumerator; int i; DimensionProvider dimensionProvider = new DimensionProvider(); if (!_originDataSource || !_destinyDataSource || !_originQuery || !_destinyQuery || (_originDataSource.file() != _destinyDataSource.file())) { return; } // Ranges for (i = 1; i <= _originDataSource.rangeCount(); i++) { queryBuildRangeOrigin = _originDataSource.range(i); queryBuildRangeAdded = _destinyDataSource.addRange(queryBuildRangeOrigin.field()); queryBuildRangeAdded.status(queryBuildRangeOrigin.status()); queryBuildRangeAdded.value(queryBuildRangeOrigin.value()); } // Filters for (i = 1; i <= _originQuery.queryFilterCount(); i++) { originQueryFilter = _originQuery.queryFilter(i); if ((originQueryFilter.DataSource().file() == _destinyDataSource.file()) && (originQueryFilter.value() != '')) { newFilter = _destinyQuery.addQueryFilter(_destinyDataSource, originQueryFilter.field()); newFilter.value(originQueryFilter.value()); } } if (_ledgerDimensionFieldName) { // dimension ranges dimensionRanges = dimensionProvider.getDimensionRangesFromQuery(_originQuery); if (!dimensionRanges.empty()) { listEnumerator = dimensionRanges.getEnumerator(); while (listEnumerator.moveNext()) { dimensionCriteria = listEnumerator.current(); if (strContains(conpeek(dimensionCriteria, DataSourceNamePosition), _originDataSource.name())) { dimensionProvider.addAttributeRangeToQueryFromRangeCon( _destinyQuery, _destinyDataSource.name(), _ledgerDimensionFieldName, dimensionCriteria); } } } } } |
miércoles, 25 de octubre de 2017
D365 - QUERIES: COPY RANGES AND FILTERS
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario