Skip to main content

Hi all

Have found a potential issue which I wonder if there is a work-around for.

We have a couple of real-time sync rules which are based on SQL Views/Custom Metadata.

Completing a change in FSM (say moving some stock) is visible in the View BUT does not sync to mobile devices. It only syncs if there is a full re-initialization.

This is an issue!

Ganners

 

Hi @ganners ,

Could you please share the name of your view? Is it a baseline one or a custom one?


Hi @Chethana

It’s a custom view called CUBIC_PARTSVAN_VIEW but is built like this…

SELECT sb.part_id
     , pa.internal_descriptn
     , pa.product_family
     , pa.product_name
     , ISNULL(pr.model_id, sb.part_id) AS model_id
     , pa.serialed
     , pp.person_id
     , ss.serial_id
     , pp.place_id
FROM dbo.stock_bin_table sb
    INNER JOIN dbo.stock_serial_id ss ON sb.part_id = ss.part_id AND sb.place_id = ss.place_id
    INNER JOIN dbo.part pa ON pa.part_id = sb.part_id
    LEFT OUTER JOIN dbo.product pr ON pa.part_id = pr.part_id AND ss.serial_id = pr.serial_id
    INNER JOIN dbo.person_place pp ON  pp.place_id = sb.place_id
                                   AND pp.place_relationship = 'FOR_STOCK'
                                   AND pp.location = 'good'
                                   AND sb.usable = 'Y'
WHERE pa.product_name <> 'SWEDEN'
 


Hi @ganners, to sync a sql view via real time you need to use it together with an actual table so that the sync rule can get triggered when a change happens.

 

So, in your case you might have to use the stock_bin_table sync rule (probably have to create it new) as your triggering point is ‘moving stock’ and refer/select your custom view data within the related query. But word of caution, due to the baseline way stock transactions developed in mobile, it uses a sql view ‘stock_bin’ with batch delta rather than the ‘stock_bin_table’, it will be bit tricky and can cause your mobile db size to increase.
 
Couple of other avenues you can try,

  • Change the business scenario and use a batch delta sync rule with 1-hour interval
  • Using a XML BR when the stock moved via ‘perform_replication_for_tables’ (note: this will have performance impacts because it will keep running for every stock transaction)
  • Using extension feature in sync rule screen (this might not be feasible in your use case as there isn’t any actual table getting synced to mobile)

Hi @ganners 

Real-time sync rules do not support views.

Cheers!


Reply