Skip to main content
Solved

Variable Retriever not receiving value from Variable Setter

  • October 12, 2021
  • 7 replies
  • 165 views

chris_acc
Contributor
Forum|alt.badge.img+5

Hello,

I am trying to obtain Max OBJECTID value from a database and pass it into Variable Setter.

The SQL Creator > Variable Setter is obtaining the correct value (just one record at present) but the Variable Retriever cannot obtain the value I think?

I hope this is a simple step or order I am missing.

Thanks in advance

Best answer by nielsgerrits

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

With you current setup it is possible that the SQLCreator fires after the other readers. The order on the Canvas has nothing to do with the order the initiation transformers (SQLCreator / Readers) are fired. I think the Readers will fire first, the SQLCreator as last. Remember, the workflow runs serial, not parallel.

 

If you replace the VariableRetriever with a FeatureMerger, connect the stream from the AttributeRounder to Requestor, SQLCreator to Supplier and set the "Join On" Requestor and Supplier Parameters both to 1, it will join the feature from the SQLCreator to each feature which passes the FeatureMerger.

 

2021-10-12_14h30_18

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • October 12, 2021

Personally I would solve this in another way. I would use a FeatureMerger with values 1=1 to supply maxobjectid to all the requestors. Or use a FeatureReader initiated by the SQLExecutor and merge maxobjectid to all features when they are being read.

 

See the "Partial Run" warning, you are using FeatureCaching, first try if it works as expected with FeatureCaching turned off. I think this is your issue.

 

If this does not solve it, make sure the VariableSetter is run upstream of your VariableRetriever. The value needs to be set before it is retrieved, else it will retrieve nothing.


chris_acc
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 29 replies
  • October 12, 2021

Personally I would solve this in another way. I would use a FeatureMerger with values 1=1 to supply maxobjectid to all the requestors. Or use a FeatureReader initiated by the SQLExecutor and merge maxobjectid to all features when they are being read.

 

See the "Partial Run" warning, you are using FeatureCaching, first try if it works as expected with FeatureCaching turned off. I think this is your issue.

 

If this does not solve it, make sure the VariableSetter is run upstream of your VariableRetriever. The value needs to be set before it is retrieved, else it will retrieve nothing.

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • October 12, 2021

To ensure the variable is set before being retrieved, I would look at using feature readers to read the data and have them triggered by the output of the SQLcreator


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • Best Answer
  • October 12, 2021

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

With you current setup it is possible that the SQLCreator fires after the other readers. The order on the Canvas has nothing to do with the order the initiation transformers (SQLCreator / Readers) are fired. I think the Readers will fire first, the SQLCreator as last. Remember, the workflow runs serial, not parallel.

 

If you replace the VariableRetriever with a FeatureMerger, connect the stream from the AttributeRounder to Requestor, SQLCreator to Supplier and set the "Join On" Requestor and Supplier Parameters both to 1, it will join the feature from the SQLCreator to each feature which passes the FeatureMerger.

 

2021-10-12_14h30_18


chris_acc
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 29 replies
  • October 12, 2021

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

MAXOBJECTID_not_addingThanks

Whilst MAXOBJECTID now seems to be populating it is adding the same number repeatedly instead of adding '1' in order to generate a unique number in each row i.e. 284, 285, 286 etc.

I tried a Counter in between SQLCreator and FeatereMerger_2 but this did not work.


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • October 12, 2021

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

If you want to generate new id, place the counter after the FeatureMerger, then an AttributeCreator to create objectid = maxobjectid + _count.


chris_acc
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 29 replies
  • October 13, 2021

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

Thanks, managed to resolve just with Counter after FeatureMerger